diff options
Diffstat (limited to '.github/workflows/labeler.yml')
-rw-r--r-- | .github/workflows/labeler.yml | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 76fc8793fa..d50e0c1f92 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -1,8 +1,9 @@ name: "Pull Request Labeler" on: pull_request_target: - types: opened + types: [opened] jobs: + triage: runs-on: ubuntu-latest permissions: @@ -12,6 +13,8 @@ jobs: - uses: actions/labeler@main with: repo-token: "${{ secrets.GITHUB_TOKEN }}" + sync-labels: "" + type-scope: runs-on: ubuntu-latest permissions: @@ -23,8 +26,22 @@ jobs: 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 + - name: "Extract commit type and add as label" + run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|([[:alpha:]]+)(\(.*\))?!?:.*|\1|')" || true + - name: "Extract commit scope and add as 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 + request-reviewer: + if: github.event.pull_request.state == 'open' && github.event.pull_request.draft == false + runs-on: ubuntu-latest + needs: ["triage", "type-scope"] + permissions: + pull-requests: write + steps: + - uses: actions/checkout@v2 + - name: 'Request reviewers' + uses: actions/github-script@v6 + with: + script: | + const script = require('./.github/scripts/reviews.js') + await script({github, context}) |