mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 21:25:04 -07:00
4c4a41c70c
Sets GH_REPO and passes PR number to `gh`, making checkout unnecessary
31 lines
960 B
YAML
31 lines
960 B
YAML
name: "Pull Request Labeler"
|
|
on:
|
|
pull_request_target:
|
|
types: opened
|
|
jobs:
|
|
triage:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
steps:
|
|
- uses: actions/labeler@main
|
|
with:
|
|
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
|
type-scope:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GH_REPO: ${{ github.repository }}
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
PR_TITLE: ${{ github.event.pull_request.title }}
|
|
steps:
|
|
# Extract type and try to add it as a label
|
|
- run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|([[:alpha:]]+)(\(.*\))?!?:.*|\1|')" || true
|
|
|
|
# Extract scope and try to add it as a label
|
|
- run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+\((.+)\)!?:.*|\1|')" || true
|