|
| 1 | +name: Daily Signature Update |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Run daily at 6:00 UTC |
| 6 | + - cron: '0 6 * * *' |
| 7 | + workflow_dispatch: # Allow manual trigger |
| 8 | + |
| 9 | +# Prevent concurrent runs from racing to commit/merge |
| 10 | +# cancel-in-progress: false means new runs wait instead of canceling in-progress ones |
| 11 | +concurrency: |
| 12 | + group: daily-update |
| 13 | + cancel-in-progress: false |
| 14 | + |
| 15 | +jobs: |
| 16 | + update: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + permissions: |
| 19 | + contents: write |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout stable branch |
| 23 | + uses: actions/checkout@v6 |
| 24 | + with: |
| 25 | + ref: stable |
| 26 | + |
| 27 | + - name: Create temporary update branch |
| 28 | + run: | |
| 29 | + git checkout -b update/daily-$(date -u +%Y-%m-%d) |
| 30 | +
|
| 31 | + - name: Set up Python |
| 32 | + uses: actions/setup-python@v6 |
| 33 | + with: |
| 34 | + python-version: "3.12" |
| 35 | + |
| 36 | + - name: Set up uv |
| 37 | + uses: astral-sh/setup-uv@v7 |
| 38 | + |
| 39 | + - name: Install dependencies |
| 40 | + run: uv sync |
| 41 | + |
| 42 | + - name: Update signatures |
| 43 | + env: |
| 44 | + BBOT_IO_API_KEY: ${{ secrets.BBOT_IO_API_KEY }} |
| 45 | + run: uv run python -m cloudcheck_update.cli |
| 46 | + |
| 47 | + - name: Update README table |
| 48 | + run: uv run python scripts/update_readme_table.py |
| 49 | + |
| 50 | + - name: Check for changes |
| 51 | + id: changes |
| 52 | + run: | |
| 53 | + if git diff --quiet; then |
| 54 | + echo "has_changes=false" >> $GITHUB_OUTPUT |
| 55 | + else |
| 56 | + echo "has_changes=true" >> $GITHUB_OUTPUT |
| 57 | + fi |
| 58 | +
|
| 59 | + - name: Commit and merge changes |
| 60 | + if: steps.changes.outputs.has_changes == 'true' |
| 61 | + run: | |
| 62 | + BRANCH="update/daily-$(date -u +%Y-%m-%d)" |
| 63 | + git config user.name "github-actions[bot]" |
| 64 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 65 | + git add cloud_providers_v2.json README.md |
| 66 | + git commit -m "chore: daily signature update $(date -u +%Y-%m-%d)" |
| 67 | + git push origin "$BRANCH" |
| 68 | + git checkout stable |
| 69 | + git merge "$BRANCH" --no-edit -m "chore: merge daily signature update" |
| 70 | + git push origin stable |
| 71 | + git push origin --delete "$BRANCH" |
0 commit comments