Satisfy updated DDEV add-on maintenance checker rules #89
Workflow file for this run
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: maintenance-check | |
| # Runs the DDEV add-on update checker (repo hygiene: #ddev-generated markers, | |
| # README sections, install.yaml structure, ...). On PRs and pushes a failure | |
| # blocks normally, since it is caused by the change under review. On scheduled | |
| # runs a failure is reported by filing/updating a labeled issue instead of | |
| # reddening the tests badge - the checker script is hosted by DDEV and its | |
| # rules can change without any change in this repo. | |
| # | |
| # No paths-ignore here: the checker validates README.md and other docs, so | |
| # markdown-only changes must still run it. | |
| on: | |
| pull_request: | |
| push: | |
| branches: [ main ] | |
| schedule: | |
| - cron: '25 08 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| maintenance-checker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Run DDEV Add-on Update Checker | |
| id: checker | |
| run: | | |
| set +e | |
| output=$(curl -fsSL https://ddev.com/s/addon-update-checker.sh | bash 2>&1) | |
| exit_code=$? | |
| echo "$output" | |
| { | |
| echo "CHECKER_OUTPUT<<CHECKER_EOF" | |
| echo "$output" | |
| echo "CHECKER_EOF" | |
| } >> "$GITHUB_ENV" | |
| exit $exit_code | |
| - name: Create or update issue on scheduled failure | |
| if: failure() && github.event_name == 'schedule' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const title = 'DDEV add-on maintenance checker is failing'; | |
| const label = 'maintenance-checker'; | |
| const body = `The scheduled DDEV add-on update checker run failed.\n\n\`\`\`\n${process.env.CHECKER_OUTPUT}\n\`\`\`\n\nReproduce locally from the add-on root:\n\`\`\`\ncurl -fsSL https://ddev.com/s/addon-update-checker.sh | bash\n\`\`\``; | |
| // Find existing open issue | |
| const issues = await github.rest.issues.listForRepo({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| state: 'open', | |
| labels: label, | |
| }); | |
| if (issues.data.length > 0) { | |
| // Update existing issue | |
| await github.rest.issues.update({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issues.data[0].number, | |
| body: body, | |
| }); | |
| console.log(`Updated issue #${issues.data[0].number}`); | |
| } else { | |
| // Ensure label exists | |
| try { | |
| await github.rest.issues.getLabel({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| name: label, | |
| }); | |
| } catch { | |
| await github.rest.issues.createLabel({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| name: label, | |
| color: 'd93f0b', | |
| description: 'Automated DDEV add-on maintenance checker failures', | |
| }); | |
| } | |
| // Create new issue | |
| const issue = await github.rest.issues.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title: title, | |
| body: body, | |
| labels: [label], | |
| }); | |
| console.log(`Created issue #${issue.data.number}`); | |
| } |