2021-05-18 00:37:18 -07:00
|
|
|
name: "Pull Request Labeler"
|
|
|
|
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:
|
2022-01-08 05:51:42 -07:00
|
|
|
|
2021-05-18 00:37:18 -07:00
|
|
|
triage:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
pull-requests: write
|
|
|
|
steps:
|
2022-05-20 20:45:10 -07:00
|
|
|
- uses: actions/labeler@v4
|
2021-05-18 00:37:18 -07:00
|
|
|
with:
|
|
|
|
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
2022-02-14 13:16:36 -07:00
|
|
|
sync-labels: ""
|
2022-01-08 05:51:42 -07:00
|
|
|
|
2021-09-30 08:08:36 -07:00
|
|
|
type-scope:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
pull-requests: write
|
|
|
|
env:
|
|
|
|
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
|
|
|
|
2022-02-13 15:15:20 -07:00
|
|
|
request-reviewer:
|
|
|
|
if: github.event.pull_request.state == 'open' && github.event.pull_request.draft == false
|
2022-02-11 07:09:50 -07:00
|
|
|
runs-on: ubuntu-latest
|
2022-02-13 15:15:20 -07:00
|
|
|
needs: ["triage", "type-scope"]
|
|
|
|
permissions:
|
|
|
|
pull-requests: write
|
2022-02-11 07:09:50 -07:00
|
|
|
steps:
|
2022-05-20 20:45:10 -07:00
|
|
|
- uses: actions/checkout@v3
|
2022-02-13 15:15:20 -07:00
|
|
|
- name: 'Request reviewers'
|
|
|
|
uses: actions/github-script@v6
|
2022-02-11 07:09:50 -07:00
|
|
|
with:
|
2022-02-13 15:15:20 -07:00
|
|
|
script: |
|
2022-02-17 08:29:28 -07:00
|
|
|
const script = require('./.github/scripts/reviews.js')
|
2022-02-13 15:15:20 -07:00
|
|
|
await script({github, context})
|