|
| 1 | +--- |
| 2 | + |
| 3 | +# The workflow template for automatic PR labeler. |
| 4 | +# It requires to have a configuration file with labels and conditions to apply them. |
| 5 | +# The configuration file should be placed in the .github folder and named auto-labeler-config.yaml. |
| 6 | +# Example file can be found there: |
| 7 | +# https://github.com/Netcracker/.github/blob/main/config/examples/auto-labeler-config.yaml |
| 8 | + |
| 9 | +name: Automatic PR Labeler |
| 10 | + |
| 11 | +on: |
| 12 | + pull_request: |
| 13 | + branches: [main] |
| 14 | + types: |
| 15 | + [opened, reopened, synchronize] |
| 16 | + |
| 17 | +permissions: |
| 18 | + pull-requests: write |
| 19 | + contents: read |
| 20 | + issues: write |
| 21 | + |
| 22 | +jobs: |
| 23 | + assign-labels: |
| 24 | + if: (github.event.pull_request.merged == false) && (github.event.pull_request.user.login != 'dependabot[bot]') && (github.event.pull_request.user.login != 'github-actions[bot]') |
| 25 | + runs-on: ubuntu-latest |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + |
| 29 | + - name: "Execute assign labels" |
| 30 | + id: action-assign-labels |
| 31 | + uses: mauroalderete/action-assign-labels@v1 |
| 32 | + with: |
| 33 | + pull-request-number: ${{ github.event.pull_request.number }} |
| 34 | + github-token: ${{ github.token }} |
| 35 | + conventional-commits: "./.github/auto-labeler-config.yaml" |
| 36 | + maintain-labels-not-matched: true |
| 37 | + apply-changes: ${{ github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id }} |
| 38 | + - name: "Drop warning if PR from fork" |
| 39 | + if: ${{ github.event.pull_request.base.repo.id != github.event.pull_request.head.repo.id }} |
| 40 | + run: | |
| 41 | + { |
| 42 | + echo "⚠️ Pull request from fork! ⚠️"; |
| 43 | + echo "Labels will not be applied to PR. Assign them manually please."; |
| 44 | + echo "Labels to assign: ${{ steps.action-assign-labels.outputs.labels-next }}"; |
| 45 | + } >> $GITHUB_STEP_SUMMARY |
0 commit comments