Skip to content

Commit

Permalink
GHA development
Browse files Browse the repository at this point in the history
  • Loading branch information
jhiemstrawisc committed Nov 27, 2024
1 parent 486dc07 commit e8c13c1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/enforce-labelling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@ jobs:
- name: Validate PR is linked to an issue
id: check_linked_issues
run: |
PR_BODY=$(jq -r '.pull_request.body' $GITHUB_EVENT_PATH)
if ! echo "$PR_BODY" | grep -qE "#[0-9]+"; then
echo "No linked issues found in the pull request description."
PR_NUMBER=$(jq -r '.pull_request.number' $GITHUB_EVENT_PATH)
REPO_OWNER=$(jq -r '.repository.owner.login' $GITHUB_EVENT_PATH)
REPO_NAME=$(jq -r '.repository.name' $GITHUB_EVENT_PATH)
LINKED_ISSUES=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/issues/$PR_NUMBER/timeline" \
| jq '[.[] | select(.event == "cross-referenced") | .source.issue.number] | length')
if [ "$LINKED_ISSUES" -eq "0" ]; then
echo "No linked issues found in the pull request."
exit 1
fi
Expand Down

0 comments on commit e8c13c1

Please sign in to comment.