Skip to content

Commit

Permalink
Update match_labels.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
gordsport committed Feb 6, 2024
1 parent 6d50935 commit b0147c7
Showing 1 changed file with 76 additions and 7 deletions.
83 changes: 76 additions & 7 deletions .github/workflows/match_labels.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---


name: "Match Labels for Changelog"
name: "Match labels for auto-gen release notes"

"on":
pull_request_target:
branches: [develop, main]
branches: [develop, main, master]
types: [opened, closed]

# Configure the project specific variables
Expand All @@ -23,15 +23,13 @@ concurrency:

jobs:
label-match:
name: "Matches issue labels to PRs"
name: "Copy applicable labels"
runs-on: ubuntu-latest
permissions: write-all
steps:

- name: "Get linked issue id and state"
id: linked-issue
env:
GH_TOKEN: ${{ secrets.GH_NEW_CARD_TO_PROJECT }}
run: |
gh api graphql -f query='
query($pr_url: URI!) {
Expand All @@ -46,7 +44,6 @@ jobs:
}
}
}' -f pr_url=$PR_URL > data.json
echo 'LINKED_ISSUE_ID='$(jq -r '.data.resource.closingIssuesReferences.nodes[] | .id' data.json) >> $GITHUB_ENV
echo 'LINKED_ISSUE_URL='$(jq -r '.data.resource.closingIssuesReferences.nodes[] | .url' data.json) >> $GITHUB_ENV
- name: "Get issues labels"
Expand Down Expand Up @@ -78,7 +75,7 @@ jobs:
- run: env

- name: "Add bug label"
id: check-labels
id: add-bug
if: |
env.BUG != ''
run: |
Expand All @@ -88,3 +85,75 @@ jobs:
clientMutationId
}
}' -f label=$BUG -f pr=$PR_ID -f user=$USER
- name: "Add breaking change label"
id: add-breaking
if: |
env.BREAKING != ''
run: |
gh api graphql -f query='
mutation($user:String!, $pr:ID!, $label:[ID!]!) {
addLabelsToLabelable(input: {clientMutationId: $user, labelableId: $pr, labelIds: $label}) {
clientMutationId
}
}' -f label=$BREAKING -f pr=$PR_ID -f user=$USER
- name: "Add deprecation label"
id: add-deprecation
if: |
env.DEPRECATE != ''
run: |
gh api graphql -f query='
mutation($user:String!, $pr:ID!, $label:[ID!]!) {
addLabelsToLabelable(input: {clientMutationId: $user, labelableId: $pr, labelIds: $label}) {
clientMutationId
}
}' -f label=$DEPRECATE -f pr=$PR_ID -f user=$USER
- name: "Add vulnerability label"
id: add-vulnerability
if: |
env.VULNERABILITY != ''
run: |
gh api graphql -f query='
mutation($user:String!, $pr:ID!, $label:[ID!]!) {
addLabelsToLabelable(input: {clientMutationId: $user, labelableId: $pr, labelIds: $label}) {
clientMutationId
}
}' -f label=$VULNERABILITY -f pr=$PR_ID -f user=$USER
- name: "Add security label"
id: add-security
if: |
env.SECURITY != ''
run: |
gh api graphql -f query='
mutation($user:String!, $pr:ID!, $label:[ID!]!) {
addLabelsToLabelable(input: {clientMutationId: $user, labelableId: $pr, labelIds: $label}) {
clientMutationId
}
}' -f label=$SECURITY -f pr=$PR_ID -f user=$USER
- name: "Add enhancement label"
id: add-enhancement
if: |
env.ENHANCE != ''
run: |
gh api graphql -f query='
mutation($user:String!, $pr:ID!, $label:[ID!]!) {
addLabelsToLabelable(input: {clientMutationId: $user, labelableId: $pr, labelIds: $label}) {
clientMutationId
}
}' -f label=$ENHANCE -f pr=$PR_ID -f user=$USER
- name: "Add feature label"
id: add-feature
if: |
env.FEATURE != ''
run: |
gh api graphql -f query='
mutation($user:String!, $pr:ID!, $label:[ID!]!) {
addLabelsToLabelable(input: {clientMutationId: $user, labelableId: $pr, labelIds: $label}) {
clientMutationId
}
}' -f label=$FEATURE -f pr=$PR_ID -f user=$USER

0 comments on commit b0147c7

Please sign in to comment.