mirror of
https://github.com/neovim/neovim.git
synced 2026-01-17 10:38:57 +10:00
This is to circumvent a limitation in GitHub Actions that requires special organization access in order to add any reviewers.
107 lines
3.9 KiB
YAML
107 lines
3.9 KiB
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
|
|
needs: ["triage"]
|
|
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:
|
|
- name: "Extract commit type and add as label"
|
|
continue-on-error: true
|
|
run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|([[:alpha:]]+)(\(.*\))?!?:.*|\1|')"
|
|
- name: "Extract commit scope and add as label"
|
|
continue-on-error: true
|
|
run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+\((.+)\)!?:.*|\1|')"
|
|
|
|
add-reviewer:
|
|
# This job currently doesn't work due to a bug in GitHub CLI.
|
|
#
|
|
# Issue: https://github.com/cli/cli/issues/4844
|
|
# PR that will fix it: https://github.com/cli/cli/pull/4876
|
|
#
|
|
# The current workaround is to temporarily add "continue-on-error" flag so
|
|
# the whole workflow doesn't get flagged as a failure.
|
|
runs-on: ubuntu-latest
|
|
needs: ["triage", "type-scope"]
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GH_REPO: ${{ github.repository }}
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
continue-on-error: true
|
|
steps:
|
|
- name: Get labels
|
|
id: labels
|
|
run: echo "::set-output name=labels::$(gh pr view $PR_NUMBER --json labels --jq '.labels.[].name' | tr '\n' '%')"
|
|
|
|
# The % at the end of the label is a hack to avoid selecting a label that
|
|
# is substring of another label. So if there is a label "cinema" then we
|
|
# don't accidentally want to interpret that as the label "ci"
|
|
|
|
- if: contains(steps.labels.outputs.labels, 'api%')
|
|
run: gh pr edit $PR_NUMBER --add-reviewer bfredl,gpanders,muniter
|
|
|
|
- if: contains(steps.labels.outputs.labels, 'ci%')
|
|
run: gh pr edit $PR_NUMBER --add-reviewer jamessan
|
|
|
|
- if: contains(steps.labels.outputs.labels, 'diagnostic%')
|
|
run: gh pr edit $PR_NUMBER --add-reviewer gpanders
|
|
|
|
- if: contains(steps.labels.outputs.labels, 'distribution%')
|
|
run: gh pr edit $PR_NUMBER --add-reviewer jamessan
|
|
|
|
- if: contains(steps.labels.outputs.labels, 'documentation%')
|
|
run: gh pr edit $PR_NUMBER --add-reviewer clason
|
|
|
|
- if: contains(steps.labels.outputs.labels, 'extmarks%')
|
|
run: gh pr edit $PR_NUMBER --add-reviewer bfredl
|
|
|
|
- if: contains(steps.labels.outputs.labels, 'filetype%')
|
|
run: gh pr edit $PR_NUMBER --add-reviewer clason,gpanders
|
|
|
|
- if: contains(steps.labels.outputs.labels, 'gui%')
|
|
run: gh pr edit $PR_NUMBER --add-reviewer glacambre,smolck
|
|
|
|
- if: contains(steps.labels.outputs.labels, 'platform:windows%')
|
|
run: gh pr edit $PR_NUMBER --add-reviewer erw7
|
|
|
|
- if: contains(steps.labels.outputs.labels, 'lsp%')
|
|
run: gh pr edit $PR_NUMBER --add-reviewer mfussenegger,mjlbach
|
|
|
|
- if: contains(steps.labels.outputs.labels, 'terminal%')
|
|
run: gh pr edit $PR_NUMBER --add-reviewer erw7
|
|
|
|
- if: contains(steps.labels.outputs.labels, 'treesitter%')
|
|
run: gh pr edit $PR_NUMBER --add-reviewer bfredl,vigoux
|
|
|
|
- if: contains(steps.labels.outputs.labels, 'typo%')
|
|
run: gh pr edit $PR_NUMBER --add-reviewer dundargoc
|
|
|
|
- if: contains(steps.labels.outputs.labels, 'ui%')
|
|
run: gh pr edit $PR_NUMBER --add-reviewer bfredl
|
|
|
|
- if: contains(steps.labels.outputs.labels, 'vim-patch%')
|
|
run: gh pr edit $PR_NUMBER --add-reviewer janlazo,seandewar
|