2023-11-12 13:40:24 -07:00
|
|
|
name: "labeler: PR"
|
2021-05-18 00:37:18 -07:00
|
|
|
on:
|
2021-07-28 02:30:08 -07:00
|
|
|
pull_request_target:
|
2022-01-07 05:32:14 -07:00
|
|
|
types: [opened]
|
2021-05-18 00:37:18 -07:00
|
|
|
jobs:
|
2023-12-09 15:40:51 -07:00
|
|
|
changed-files:
|
2021-05-18 00:37:18 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
pull-requests: write
|
|
|
|
steps:
|
2023-12-08 02:41:11 -07:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/labeler@v5
|
2021-05-18 00:37:18 -07:00
|
|
|
with:
|
2023-12-08 02:41:11 -07:00
|
|
|
configuration-path: .github/scripts/labeler_configuration.yml
|
2022-01-08 05:51:42 -07:00
|
|
|
|
2021-09-30 08:08:36 -07:00
|
|
|
type-scope:
|
2023-12-09 15:40:51 -07:00
|
|
|
needs: changed-files
|
2021-09-30 08:08:36 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
pull-requests: write
|
|
|
|
env:
|
2023-04-17 04:11:29 -07:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-10-15 07:08:12 -07:00
|
|
|
GH_REPO: ${{ github.repository }}
|
|
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
|
|
PR_TITLE: ${{ github.event.pull_request.title }}
|
2021-09-30 08:08:36 -07:00
|
|
|
steps:
|
2022-01-08 05:51:42 -07:00
|
|
|
- name: "Extract commit type and add as label"
|
2022-02-11 08:09:12 -07:00
|
|
|
run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|([[:alpha:]]+)(\(.*\))?!?:.*|\1|')" || true
|
2022-01-08 05:51:42 -07:00
|
|
|
- name: "Extract commit scope and add as label"
|
2022-02-11 08:09:12 -07:00
|
|
|
run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+\((.+)\)!?:.*|\1|')" || true
|
2022-03-25 12:30:42 -07:00
|
|
|
- name: "Extract if the PR is a breaking change and add it as label"
|
|
|
|
run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+(\(.*\))?!:.*|breaking-change|')" || true
|
2022-02-11 07:09:50 -07:00
|
|
|
|
2024-07-21 05:55:34 -07:00
|
|
|
target-release:
|
2023-12-09 15:40:51 -07:00
|
|
|
needs: ["changed-files", "type-scope"]
|
2024-07-21 05:55:34 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
pull-requests: write
|
|
|
|
steps:
|
|
|
|
- if: startsWith(github.base_ref, 'release')
|
|
|
|
uses: actions/github-script@v7
|
|
|
|
with:
|
|
|
|
script: |
|
|
|
|
github.rest.issues.addLabels({
|
|
|
|
issue_number: context.issue.number,
|
|
|
|
owner: context.repo.owner,
|
|
|
|
repo: context.repo.repo,
|
|
|
|
labels: ['target:release']
|
|
|
|
})
|
|
|
|
|
|
|
|
request-reviewer:
|
|
|
|
needs: ["changed-files", "type-scope", "target-release"]
|
2022-02-13 15:15:20 -07:00
|
|
|
permissions:
|
|
|
|
pull-requests: write
|
2023-11-12 13:40:24 -07:00
|
|
|
uses: ./.github/workflows/reviewers_add.yml
|