|
| 1 | +name: Labeler |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + paths: |
| 7 | + - '../labels.yml' |
| 8 | + |
| 9 | + |
| 10 | +jobs: |
| 11 | + |
| 12 | + label-syncer: |
| 13 | + name: Syncer |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v2 |
| 17 | + - uses: micnncim/action-label-syncer@v1 |
| 18 | + env: |
| 19 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 20 | + |
| 21 | + labeler: |
| 22 | + name: Set labels |
| 23 | + needs: [label-syncer] |
| 24 | + permissions: |
| 25 | + contents: read |
| 26 | + pull-requests: write |
| 27 | + runs-on: ubuntu-latest |
| 28 | + steps: |
| 29 | + |
| 30 | + # Label based on modified files |
| 31 | + - name: Label based on changed files |
| 32 | + uses: actions/labeler@v4 |
| 33 | + with: |
| 34 | + repo-token: "${{ secrets.GITHUB_TOKEN }}" |
| 35 | + sync-labels: '' |
| 36 | + |
| 37 | + # Label based on branch name |
| 38 | + - uses: actions-ecosystem/action-add-labels@v1 |
| 39 | + if: | |
| 40 | + startsWith(github.event.pull_request.head.ref, 'doc') || |
| 41 | + startsWith(github.event.pull_request.head.ref, 'docs') |
| 42 | + with: |
| 43 | + labels: documentation |
| 44 | + |
| 45 | + - uses: actions-ecosystem/action-add-labels@v1 |
| 46 | + if: | |
| 47 | + startsWith(github.event.pull_request.head.ref, 'maint') || |
| 48 | + startsWith(github.event.pull_request.head.ref, 'no-ci') || |
| 49 | + startsWith(github.event.pull_request.head.ref, 'ci') |
| 50 | + with: |
| 51 | + labels: maintenance |
| 52 | + |
| 53 | + - uses: actions-ecosystem/action-add-labels@v1 |
| 54 | + if: startsWith(github.event.pull_request.head.ref, 'feat') |
| 55 | + with: |
| 56 | + labels: | |
| 57 | + enhancement |
| 58 | +
|
| 59 | + - uses: actions-ecosystem/action-add-labels@v1 |
| 60 | + if: | |
| 61 | + startsWith(github.event.pull_request.head.ref, 'fix') || |
| 62 | + startsWith(github.event.pull_request.head.ref, 'patch') |
| 63 | + with: |
| 64 | + labels: bug |
| 65 | + |
| 66 | + commenter: |
| 67 | + runs-on: ubuntu-latest |
| 68 | + steps: |
| 69 | + - name: Suggest to add labels |
| 70 | + uses: peter-evans/create-or-update-comment@v2 |
| 71 | + # Execute only when no labels have been applied to the pull request |
| 72 | + if: toJSON(github.event.pull_request.labels.*.name) == '{}' |
| 73 | + with: |
| 74 | + issue-number: ${{ github.event.pull_request.number }} |
| 75 | + body: | |
| 76 | + Please add one of the following labels to add this contribution to the Release Notes :point_down: |
| 77 | + - [bug](https://github.com/pyansys/ansys-templates/pulls?q=label%3Abug+) |
| 78 | + - [documentation](https://github.com/pyansys/ansys-templates/pulls?q=label%3Adocumentation+) |
| 79 | + - [enhancement](https://github.com/pyansys/ansys-templates/pulls?q=label%3Aenhancement+) |
| 80 | + - [good first issue](https://github.com/pyansys/ansys-templates/pulls?q=label%3Agood+first+issue) |
| 81 | + - [maintenance](https://github.com/pyansys/ansys-templates/pulls?q=label%3Amaintenance+) |
| 82 | + - [release](https://github.com/pyansys/ansys-templates/pulls?q=label%3Arelease+) |
0 commit comments