mirror of
https://github.com/catdevnull/preciazo.git
synced 2024-11-22 22:26:19 +00:00
Compare commits
No commits in common. "ca71dba59c23050c43a25c294257262a3b3fb462" and "d6fa8743c98f009371b840d2e8e72b6ac3584ae9" have entirely different histories.
ca71dba59c
...
d6fa8743c9
2 changed files with 6 additions and 15 deletions
5
.github/workflows/sepa-precios-archiver.yml
vendored
5
.github/workflows/sepa-precios-archiver.yml
vendored
|
@ -7,8 +7,8 @@ on:
|
|||
|
||||
jobs:
|
||||
archive-prices:
|
||||
runs-on: ubicloud-standard-2
|
||||
# runs-on: ubuntu-latest
|
||||
# runs-on: ubicloud-standard-4
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
@ -23,7 +23,6 @@ jobs:
|
|||
- name: Run archiver script
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ARCHIVE_GITHUB_TOKEN }}
|
||||
GH_TOKEN: ${{ secrets.GH_PRECIAZO_TOKEN }}
|
||||
B2_BUCKET_NAME: ${{ secrets.B2_BUCKET_NAME }}
|
||||
B2_BUCKET_KEY_ID: ${{ secrets.B2_BUCKET_KEY_ID }}
|
||||
B2_BUCKET_KEY: ${{ secrets.B2_BUCKET_KEY }}
|
||||
|
|
|
@ -32,25 +32,17 @@ const s3 = new S3Client({
|
|||
},
|
||||
});
|
||||
|
||||
async function getRawDatasetInfo(attempts = 0) {
|
||||
async function getRawDatasetInfo() {
|
||||
try {
|
||||
return await $`curl -L https://datos.produccion.gob.ar/api/3/action/package_show?id=sepa-precios`.json();
|
||||
} catch (error) {
|
||||
if (attempts >= 4) {
|
||||
console.error(`❌ Error fetching dataset info`, error);
|
||||
if (process.env.GITHUB_RUN_ID) {
|
||||
console.info(`🔄 Retrying action`);
|
||||
await $`gh run rerun ${process.env.GITHUB_RUN_ID} --workflow sepa-precios-archiver`;
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
console.error(
|
||||
`❌ Error fetching dataset info`,
|
||||
error,
|
||||
`retrying in 30s...`
|
||||
`retrying in 5min...`
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, 30 * 1000));
|
||||
return await getRawDatasetInfo(attempts + 1);
|
||||
await new Promise((resolve) => setTimeout(resolve, 5 * 60 * 1000));
|
||||
return await getRawDatasetInfo();
|
||||
}
|
||||
}
|
||||
async function saveFileIntoRepo(fileName: string, fileContent: string) {
|
||||
|
|
Loading…
Reference in a new issue