Skip to content

Commit

Permalink
Set PR milestone from base branch (#13712)
Browse files Browse the repository at this point in the history
* Add pipeline to set PR milestone

Signed-off-by: Ahmed Kamal <[email protected]>

* Implementation

Signed-off-by: Ahmed Kamal <[email protected]>

* Target PR_NUMBER. Trigger on closed

Signed-off-by: Ahmed Kamal <[email protected]>

* Fix

Signed-off-by: Ahmed Kamal <[email protected]>
  • Loading branch information
kim0 authored Jun 10, 2022
1 parent 91a6dd2 commit 5b12e63
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/set-milestone-from-base-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Set PR Milestone

on:
pull_request:
types: [closed]
branches: [master, 1.*]

jobs:
set-milestone:
runs-on: ubuntu-latest
steps:
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_NAME: ${{ github.event.repository.full_name }}
PR_NUMBER: ${{ github.event.number }}
run: |
readarray -t milestones < <(gh api /repos/brave/brave-core/milestones -q '.[] | .title')
if [ "$GITHUB_BASE_REF" = "master" ]; then
milestone_selector="Nightly"
else
milestone_selector="$GITHUB_BASE_REF"
fi
milestone=$(printf "%s\n" "${milestones[@]}" | grep -E "$milestone_selector")
gh pr edit "$PR_NUMBER" -R "$REPO_NAME" -m "$milestone"

0 comments on commit 5b12e63

Please sign in to comment.