PR Actions Detective #5017
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: PR Actions Detective | |
| on: | |
| workflow_run: | |
| workflows: | |
| [ | |
| "Validate Dashboard Compilation", | |
| "Vale Lint", | |
| "Documentation edit helper", | |
| "catalog-info", | |
| "docs-cleanup", | |
| "docs-build", | |
| ] | |
| types: [completed] | |
| permissions: | |
| actions: read | |
| contents: read | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| gate: | |
| if: >- | |
| github.event.workflow_run.conclusion == 'failure' && | |
| toJSON(github.event.workflow_run.pull_requests) != '[]' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| enabled: ${{ steps.gate.outputs.enabled }} | |
| steps: | |
| - id: gate | |
| uses: actions/github-script@v9 | |
| with: | |
| script: | | |
| const prNumber = context.payload.workflow_run.pull_requests[0].number; | |
| const pr = await github.rest.pulls.get({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: prNumber, | |
| }); | |
| const enabled = !(pr.data.labels || []).some((label) => label.name === "no-pr-actions-detective"); | |
| core.info(`PR #${prNumber} no-pr-actions-detective absent (enabled): ${enabled}`); | |
| core.setOutput("enabled", enabled ? "true" : "false"); | |
| run: | |
| needs: gate | |
| if: needs.gate.outputs.enabled == 'true' | |
| uses: elastic/ai-github-actions/.github/workflows/gh-aw-pr-actions-detective.lock.yml@v0 | |
| secrets: | |
| COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} |