Skip to content

Commit

Permalink
Merge branch 'iamnhan' of https://github.com/nhan295/pymc-marketing i…
Browse files Browse the repository at this point in the history
…nto iamnhan
  • Loading branch information
nhan295 committed Oct 24, 2024
2 parents ec2ee18 + 7ea372e commit aaaff63
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions .github/workflows/pr-auto-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,47 @@ on:
- pull_request_target

jobs:
labeler:
file-change:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
- name: Run Labeler Action
uses: actions/labeler@v5

sync:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Sync labels with closing issues
run: |
owner="pymc-labs"
name="pymc-marketing"
pr_number=${{ github.event.pull_request.number }}
labels=$(gh api graphql --paginate -F number=$pr_number -F owner=$owner -F name=$name -f query='
query($endCursor: String, $owner: String!, $name: String!, $number: Int!) {
repository(owner: $owner, name: $name) {
pullRequest(number: $number) {
closingIssuesReferences(first: 10, after: $endCursor) {
nodes {
labels(first: 10) {
nodes {
name
}
}
}
}
}
}
}
' --jq '.data.repository.pullRequest.closingIssuesReferences.nodes | map(.labels.nodes | map(.name)) | flatten | unique | join(",")')
gh pr edit $pr_number --add-label "$labels"
env:
GH_TOKEN: ${{ github.token }}

0 comments on commit aaaff63

Please sign in to comment.