daily #6
This file contains hidden or 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: daily | |
| on: | |
| schedule: | |
| - cron: "0 0 * * *" # Run every day at midnight UTC | |
| workflow_dispatch: | |
| permissions: {} # No permissions by default | |
| jobs: | |
| build-parameters: | |
| name: Prepare build parameters | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| outputs: | |
| build_version: "${{ steps.build-version.outputs.version }}" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: build-version | |
| id: build-version | |
| uses: ./.github/actions/build-version | |
| distrib: | |
| name: Daily Distrib Check | |
| needs: build-parameters | |
| uses: ./.github/workflows/distrib.yml | |
| permissions: | |
| contents: read | |
| with: | |
| build_version: ${{ needs.build-parameters.outputs.build_version }} | |
| create-issue-on-failure: | |
| name: Create issue on scheduled workflow failure | |
| runs-on: ubuntu-latest | |
| needs: distrib | |
| if: failure() | |
| permissions: | |
| issues: write # Permission to create issues | |
| steps: | |
| - name: Create GitHub Issue | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 | |
| with: | |
| script: | | |
| const workflowRunUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; | |
| const issueTitle = `[Scheduled Check] Distrib workflow failed - ${new Date().toISOString().split('T')[0]}`; | |
| const issueBody = `## Bug Report | |
| **Type:** Bug | |
| **Description:** The scheduled distrib workflow has failed. | |
| **Failed Workflow Run:** [View the failed run](${workflowRunUrl}) | |
| **Triggered at:** ${new Date().toISOString()} | |
| **Workflow:** ${context.workflow} | |
| **Run ID:** ${context.runId} | |
| Please investigate the failure and take appropriate action. | |
| `; | |
| await github.rest.issues.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title: issueTitle, | |
| body: issueBody, | |
| labels: ['bug'] | |
| }); |