|
| 1 | +# Prepare and validate a PR for auto-generated release notes: |
| 2 | +# - if the title starts with `feat` or `fix` adds the label (`feat`, `fix`) used |
| 3 | +# by the release notes to include the PR in the appropriate section. |
| 4 | +# - each PR that is a `feat` or `fix` must also include either a |
| 5 | +# `feature flagged` or `release notes` label, PRs that have the `feature flagged` |
| 6 | +# label will not be included in the release notes. |
| 7 | +# |
| 8 | +name: Release Notes - Labels |
| 9 | +on: |
| 10 | + pull_request: |
| 11 | + types: [opened, edited, labeled, unlabeled, synchronize] |
| 12 | +jobs: |
| 13 | + label: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + env: |
| 16 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 17 | + steps: |
| 18 | + - name: remove label |
| 19 | + uses: actions-ecosystem/action-remove-labels@v1 |
| 20 | + with: |
| 21 | + labels: | |
| 22 | + fix |
| 23 | + feat |
| 24 | +
|
| 25 | + - name: add label based on title - fix |
| 26 | + if: | |
| 27 | + startsWith(github.event.pull_request.title, 'fix:') || |
| 28 | + startsWith(github.event.pull_request.title, 'fix(') |
| 29 | + uses: actions-ecosystem/action-add-labels@v1 |
| 30 | + with: |
| 31 | + labels: fix |
| 32 | + |
| 33 | + - name: add label based on title - feat |
| 34 | + if: | |
| 35 | + startsWith(github.event.pull_request.title, 'feat:') || |
| 36 | + startsWith(github.event.pull_request.title, 'feat(') |
| 37 | + uses: actions-ecosystem/action-add-labels@v1 |
| 38 | + with: |
| 39 | + labels: feat |
| 40 | + |
| 41 | + - uses: mheap/github-action-required-labels@v1 |
| 42 | + with: |
| 43 | + mode: maximum |
| 44 | + count: 0 |
| 45 | + labels: "wip, work in progress, work-in-progress" |
| 46 | + |
| 47 | + - uses: mheap/github-action-required-labels@v1 |
| 48 | + if: | |
| 49 | + startsWith(github.event.pull_request.title, 'fix:') || |
| 50 | + startsWith(github.event.pull_request.title, 'fix(') || |
| 51 | + startsWith(github.event.pull_request.title, 'feat:') || |
| 52 | + startsWith(github.event.pull_request.title, 'feat(') |
| 53 | + with: |
| 54 | + mode: minimum |
| 55 | + count: 1 |
| 56 | + labels: "feature flagged, release notes" |
0 commit comments