Skip to content

fix: update dbCAN database URLs to use new pro.unl.edu domain #10

fix: update dbCAN database URLs to use new pro.unl.edu domain

fix: update dbCAN database URLs to use new pro.unl.edu domain #10

name: Check Database URLs
on:
schedule:
# Run weekly on Monday at 2 AM UTC
- cron: '0 2 * * 1'
workflow_dispatch: # Allow manual triggering
push:
paths:
- 'funannotate2/downloads.json' # Run when downloads.json is updated
jobs:
check-urls:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest requests
- name: Check database URLs
run: |
pytest tests/unit/test_database_urls.py -v --tb=short
- name: Create issue if URLs are broken
if: failure()
uses: actions/github-script@v7
with:
script: |
const title = '🔗 Database URLs are unreachable';
const body = `## Database URL Check Failed
The automated weekly check for database URLs has failed. One or more URLs in \`funannotate2/downloads.json\` are not reachable.
**Workflow run:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
Please check the workflow logs for details on which URLs are failing and update \`funannotate2/downloads.json\` accordingly.
### Common causes:
- Database has moved to a new URL
- Database server is temporarily down
- Database version has been updated
- Network connectivity issues
---
*This issue was automatically created by the [Check Database URLs workflow](${{ github.server_url }}/${{ github.repository }}/blob/main/.github/workflows/check-database-urls.yml)*`;
// Check if an issue already exists
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'database-urls'
});
if (issues.data.length === 0) {
// Create new issue
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: title,
body: body,
labels: ['database-urls', 'bug', 'automated']
});
} else {
// Add comment to existing issue
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issues.data[0].number,
body: `Database URLs are still failing as of ${new Date().toISOString()}\n\n**Workflow run:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`
});
}