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:
|
|
|
|
- uses: actions/labeler@main
|
|
|
|
with:
|
|
|
|
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
2022-01-08 05:51:42 -07:00
|
|
|
|
2021-09-30 08:08:36 -07:00
|
|
|
type-scope:
|
|
|
|
runs-on: ubuntu-latest
|
2022-01-07 05:32:14 -07:00
|
|
|
needs: ["triage"]
|
2021-09-30 08:08:36 -07:00
|
|
|
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-02-11 07:09:50 -07:00
|
|
|
|
|
|
|
upload-pr-number:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Save PR number
|
|
|
|
run: |
|
|
|
|
mkdir -p pr
|
|
|
|
echo ${{ github.event.number }} > pr/pr_number
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: pr_number
|
|
|
|
path: pr/
|