Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/pr-metadata-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
steps:
- name: Check for assignee, labels, and milestone
env:
ASSIGNEES: ${{ toJson(github.event.pull_request.assignees) }}
LABELS: ${{ toJson(github.event.pull_request.labels) }}
MILESTONE: ${{ github.event.pull_request.milestone && github.event.pull_request.milestone.title || '' }}
PR_URL: ${{ github.event.pull_request.html_url }}
PR_NUMBER: ${{ github.event.pull_request.number }}
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IS_BOT: ${{ github.actor == 'dependabot[bot]' || github.actor == 'pre-commit-ci[bot]' || github.actor == 'copy-pr-bot[bot]' }}
IS_DRAFT: ${{ github.event.pull_request.draft }}
run: |
Expand All @@ -37,6 +37,15 @@ jobs:
exit 0
fi

# Fetch live PR data to avoid stale event payload (race condition
# when labels/milestone are added shortly after PR creation).
PR_JSON=$(gh pr view "${PR_NUMBER}" --repo "${GH_REPO}" \
--json assignees,labels,milestone \
--jq '{assignees: .assignees, labels: .labels, milestone: (.milestone.title // empty)}')
ASSIGNEES=$(echo "$PR_JSON" | jq '.assignees')
LABELS=$(echo "$PR_JSON" | jq '.labels')
MILESTONE=$(echo "$PR_JSON" | jq -r '.milestone')

ERRORS=""

ASSIGNEE_COUNT=$(echo "$ASSIGNEES" | jq 'length')
Expand Down
Loading