2021-05-18 00:37:18 -07:00
|
|
|
name: "Pull Request Labeler"
|
|
|
|
on:
|
2021-07-28 02:30:08 -07:00
|
|
|
pull_request_target:
|
|
|
|
types: opened
|
2021-05-18 00:37:18 -07:00
|
|
|
jobs:
|
|
|
|
triage:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
pull-requests: write
|
|
|
|
steps:
|
|
|
|
- uses: actions/labeler@main
|
|
|
|
with:
|
|
|
|
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
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:
|
|
|
|
# Extract type and try to add it as a label
|
2021-10-15 07:08:12 -07:00
|
|
|
- run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|([[:alpha:]]+)(\(.*\))?!?:.*|\1|')" || true
|
2021-09-30 08:08:36 -07:00
|
|
|
|
|
|
|
# Extract scope and try to add it as a label
|
2021-10-15 07:08:12 -07:00
|
|
|
- run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+\((.+)\)!?:.*|\1|')" || true
|