-
Notifications
You must be signed in to change notification settings - Fork 809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tag Boost milestones #41470
Tag Boost milestones #41470
Changes from all commits
bbcf08a
83756d0
8e99e46
656e57f
e3fe5a2
3065686
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,44 @@ | ||||||
name: Tag Boost PRs with milestone | ||||||
|
||||||
on: | ||||||
pull_request: | ||||||
types: [closed] | ||||||
|
||||||
jobs: | ||||||
tag-pr: | ||||||
runs-on: ubuntu-latest | ||||||
if: | | ||||||
github.event.pull_request.merged == true && | ||||||
contains(github.event.pull_request.labels.*.name, '[Plugin] Boost') | ||||||
env: | ||||||
MILESTONE_NAME: "boost/next" | ||||||
|
||||||
steps: | ||||||
- name: Checkout repository | ||||||
uses: actions/checkout@v2 | ||||||
|
||||||
- name: Create the milestone if it doesn't exist | ||||||
env: | ||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||
REPO: ${{ github.repository }} | ||||||
run: | | ||||||
if ! gh api repos/${REPO}/milestones --jq '.[] | select(.title=="'"$MILESTONE_NAME"'")' | grep -q "$MILESTONE_NAME"; then | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be done a bit more cleanly as something like
Suggested change
Using |
||||||
echo "Creating milestone $MILESTONE_NAME" | ||||||
gh api repos/${REPO}/milestones -F title="$MILESTONE_NAME" -F state="open" | ||||||
else | ||||||
echo "Milestone $MILESTONE_NAME already exists" | ||||||
fi | ||||||
|
||||||
- name: Set milestone on PR if none is set | ||||||
env: | ||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||
PR_NUMBER: ${{ github.event.pull_request.number }} | ||||||
run: | | ||||||
milestone=$(gh pr view ${PR_NUMBER} --json milestone --jq '.milestone.title') | ||||||
if [ "$milestone" = "null" ] || [ -z "$milestone" ]; then | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bash syntax
Suggested change
|
||||||
echo "Setting milestone $MILESTONE_NAME on PR #${PR_NUMBER}" | ||||||
gh pr edit ${PR_NUMBER} --milestone "$MILESTONE_NAME" | ||||||
else | ||||||
echo "PR already has milestone: $milestone" | ||||||
fi | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actions/checkout is up to v4 by now.