|
| 1 | +# This workflow ensures that a change was made to the changelog |
| 2 | +--- |
| 3 | +name: Changelog Changed |
| 4 | +run-name: >- |
| 5 | + ${{ |
| 6 | + format( |
| 7 | + '{0} - Changelog Changed{1}', |
| 8 | + github.event_name == 'pull_request' |
| 9 | + && format('PR#{0}{1}',github.event.number, github.event.pull_request.draft && ' [DRAFT]' || '') |
| 10 | + || format('Push [{0}]', github.ref_name), |
| 11 | + github.event_name == 'pull_request' |
| 12 | + && format(' - [{0}-to-{1}]', github.event.pull_request.head.ref, github.event.pull_request.base.ref) |
| 13 | + || '' |
| 14 | + ) |
| 15 | + }} |
| 16 | +on: |
| 17 | + pull_request: |
| 18 | + branches: |
| 19 | + - main |
| 20 | + - develop |
| 21 | + types: |
| 22 | + - opened |
| 23 | + - reopened |
| 24 | + - synchronize |
| 25 | + - ready_for_review |
| 26 | + # Trigger if target branch was changed to a trunk |
| 27 | + pull_request_target: |
| 28 | + types: |
| 29 | + - edited |
| 30 | + branches: |
| 31 | + - main |
| 32 | + - develop |
| 33 | + |
| 34 | +concurrency: |
| 35 | + group: Changelog-${{ github.event.pull_request.head.ref }}-to-${{ github.event.pull_request.base.ref }} |
| 36 | + cancel-in-progress: true |
| 37 | + |
| 38 | +jobs: |
| 39 | + checkForChangesToChangelog: |
| 40 | + name: Changelog Changed |
| 41 | + permissions: |
| 42 | + contents: read # Read access to code and content in the repository |
| 43 | + pull-requests: read # Read access to pull request metadata for the event |
| 44 | + checks: write # Write access to report check results |
| 45 | + runs-on: ubuntu-latest |
| 46 | + if: ${{ !github.event.pull_request.draft }} |
| 47 | + |
| 48 | + steps: |
| 49 | + # Checkout pull request branch |
| 50 | + - name: ${{ format('Checkout [{0}]', github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name) }} |
| 51 | + uses: actions/checkout@v4 |
| 52 | + with: |
| 53 | + ref: ${{ github.event.pull_request.head.ref }} |
| 54 | + token: ${{ secrets.TJC_TOKEN || secrets.GITHUB_TOKEN }} |
| 55 | + |
| 56 | + # Check for Changes in Changelog |
| 57 | + - name: Check for Changes to Changelog |
| 58 | + id: getChanges |
| 59 | + uses: tj-actions/changed-files@v45.0.8 |
| 60 | + with: |
| 61 | + files: CHANGELOG.md |
| 62 | + |
| 63 | + # Report Success |
| 64 | + - name: Success - Changelog Changed |
| 65 | + if: steps.getChanges.outputs.any_modified == 'true' |
| 66 | + uses: ./.github/actions/tools/annotation/notice |
| 67 | + with: |
| 68 | + message: "[Success] Changelog Changed" |
| 69 | + |
| 70 | + # Report Failure |
| 71 | + - name: Failure - Changelog Not Changed |
| 72 | + if: steps.getChanges.outputs.any_modified != 'true' |
| 73 | + uses: ./.github/actions/tools/exit-code |
| 74 | + with: |
| 75 | + code: 5 |
| 76 | + message: "Changelog Not Changed" |
0 commit comments