Skip to content

PR Buildkite Detective #2411514

PR Buildkite Detective

PR Buildkite Detective #2411514

name: PR Buildkite Detective
on:
status:
permissions:
actions: read
contents: read
copilot-requests: write
issues: write
pull-requests: write # required by gh-aw compiler for add-comment
jobs:
check-pr:
if: >-
github.event.state == 'failure' &&
contains(github.event.context, 'buildkite')
runs-on: ubuntu-latest
outputs:
has-open-pr: ${{ steps.find-pr.outputs.has-open-pr }}
steps:
- name: Check for open PR associated with commit
id: find-pr
env:
GH_TOKEN: ${{ github.token }}
run: |
count=$(gh api "repos/${{ github.repository }}/commits/${{ github.event.sha }}/pulls" \
--jq '[.[] | select(.state == "open")] | length')
if [ "$count" -gt 0 ]; then
echo "has-open-pr=true" >> "$GITHUB_OUTPUT"
else
echo "has-open-pr=false" >> "$GITHUB_OUTPUT"
fi
run:
needs: check-pr
if: needs.check-pr.outputs.has-open-pr == 'true'
uses: elastic/ai-github-actions/.github/workflows/gh-aw-estc-pr-buildkite-detective.lock.yml@v0
with:
report-failure-as-issue: false
secrets:
BUILDKITE_API_TOKEN: ${{ secrets.BUILDKITE_LOGS_API_TOKEN }}