workflow catalog not being build for past months #73
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test repo | |
on: | |
issue_comment: | |
types: | |
- created | |
- edited | |
jobs: | |
test-repo: | |
runs-on: ubuntu-latest | |
if: >- | |
startsWith(github.event.comment.body, '/catalog test repo') | |
steps: | |
- uses: actions/github-script@v5 | |
id: info | |
env: | |
BODY: ${{ github.event.comment.body }} | |
with: | |
script: | | |
const process = require("process") | |
const sleep = require('util').promisify(setTimeout) | |
const test_repo = process.env.BODY.match(/\/catalog test repo ([^\/]+\/[^\/]+)/)[1] | |
while (true) { | |
const rate_limit = (await github.rest.rateLimit.get()).data.rate | |
if (rate_limit.remaining <= 0) { | |
console.log(rate_limit.reset) | |
console.log(Date.now() / 1000) | |
const tosleep = rate_limit.reset - (Date.now() / 1000) + 5 | |
console.log(`Rate limit exceeded, waiting for ${tosleep} seconds.`) | |
await sleep(tosleep * 1000) | |
} | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `Testing catalog parsing for repository https://github.com/${test_repo}.\nResults: https://github.com/snakemake/snakemake-workflow-catalog/actions/workflows/test-repo.yml` | |
}) | |
return { | |
test_repo: test_repo | |
} | |
} | |
- name: Post action link | |
uses: peter-evans/create-or-update-comment@v1 | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
Testing catalog parsing for repository https://github.com/${{ fromJSON(steps.info.outputs.result).test_repo }}. | |
Results: https://github.com/snakemake/snakemake-workflow-catalog/actions/workflows/test-repo.yml | |
- uses: actions/checkout@v1 | |
- name: deployment | |
uses: mamba-org/provision-with-micromamba@main | |
- name: generate-catalog | |
shell: bash -l {0} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TEST_REPO: ${{ fromJSON(steps.info.outputs.result).test_repo }} | |
run: | | |
python scripts/generate-catalog.py | |