Skip to content

Commit

Permalink
ci: set milestone on issues linked to PRs
Browse files Browse the repository at this point in the history
Fixes apache#603.
  • Loading branch information
lidavidm committed Feb 12, 2024
1 parent 1e1a576 commit 86ad239
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/dev_pr/milestone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,27 @@ main() {
echo "Assigning milestone: ${milestone}"

gh pr edit "${pr_number}" -m "${milestone}"

local -r repo_owner=$(echo "${repo}" | cut -d'/' -f1)
local -r repo_name=$(echo "${repo}" | cut -d'/' -f2)
local -r graphql_query="{
repository(owner: \"${repo_owner}\", name: \"${repo_name}\") {
pullRequest(number: ${pr_number}) {
closingIssuesReferences(first: 5) {
edges {
node {
number
}
}
}
}
}
}"
local -r linked_issues=$(gh api graphql -f query="${graphql_query}" | jq -r '.data.repository.pullRequest.closingIssuesReferences.edges | .[].node.number')
for issue in ${linked_issues}; do
echo "Linked issue: ${issue}"
gh issue edit "${issue}" --milestone "${milestone}"
done
}

main "$@"

0 comments on commit 86ad239

Please sign in to comment.