Pre triage pr#50977
Closed
shawkins wants to merge 5 commits into
Closed
Conversation
Signed-off-by: Steve Hawkins <shawkins@redhat.com>
Signed-off-by: Steve Hawkins <shawkins@redhat.com>
shawkins
enabled auto-merge (squash)
July 17, 2026 12:06
auto-merge was automatically disabled
July 17, 2026 12:07
Pull request was closed
Contributor
There was a problem hiding this comment.
Pull request overview
Adds automated pre-triage validation for pull-request and commit issue links.
Changes:
- Validates issue-link formatting, consistency, and state.
- Posts failure comments and manages triage labels.
- Supports a label-based validation bypass.
|
|
||
| on: | ||
| pull_request_target: | ||
| types: [opened, edited, reopened, synchronize] |
Comment on lines
+14
to
+16
| permissions: | ||
| issues: write | ||
| pull-requests: write |
| FAILED=0 | ||
| ERRORS="" | ||
| MARKER="<!-- pre-triage-linked-issues -->" | ||
| SKIP_LABEL="skip-issue-check" |
Comment on lines
+45
to
+46
| EXISTING_COMMENT_ID=$(gh api "repos/$REPO/issues/$PR_NUMBER/comments" \ | ||
| --jq ".[] | select(.body | contains(\"$MARKER\")) | .id" | head -1 || true) |
Comment on lines
+148
to
+151
| STATE=$(printf '%s' "$ISSUE_DATA" | jq -r '.state') | ||
| if [ "$STATE" != "open" ]; then | ||
| add_error "Issue #$issue is not open (current state: $STATE)" | ||
| fi |
Comment on lines
+156
to
+157
| EXISTING_COMMENT_ID=$(gh api "repos/$REPO/issues/$PR_NUMBER/comments" \ | ||
| --jq ".[] | select(.body | contains(\"$MARKER\")) | .id" | head -1 || true) |
| Thank you for contributing this PR. The following linked issue checks failed: | ||
| ${ERRORS} | ||
|
|
||
| Please refer to [CONTRIBUTING.md](https://github.com/${REPO}/blob/main/CONTRIBUTING.md) for requirements." |
|
|
||
| - name: Add label | ||
| if: steps.check-linked-issues.outcome == 'failure' | ||
| run: gh pr edit "${{ github.event.pull_request.number }}" -R "$GITHUB_REPOSITORY" --add-label "action/waiting-for-author" |
| # --- Enforce Closes vs Resolves based on issue count --- | ||
| ISSUE_COUNT=$(printf '%s\n' "$PR_ISSUES" | grep -c '.' || true) | ||
| if [ "$ISSUE_COUNT" -eq 1 ]; then | ||
| if printf '%s\n' "$PR_BODY" | grep -qE '^Resolves #[0-9]+'; then |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.