|
9 | 9 | triggerLabelQuick: "tests-requested: quick"
|
10 | 10 | statusLabelInProgress: "tests: in-progress"
|
11 | 11 | statusLabelFailed: "tests: failed"
|
| 12 | + skipReleaseNotesLabel: "skip-release-notes" |
12 | 13 |
|
13 | 14 | jobs:
|
14 | 15 | file_format_check:
|
|
92 | 93 | run: |
|
93 | 94 | set -e
|
94 | 95 | bash scripts/gha/check_copyright.sh -g
|
| 96 | +
|
| 97 | + release_notes_check: |
| 98 | + # Check that the readme was updated, unless the PR has a specific label set (env.skipReleaseNotesLabel). |
| 99 | + runs-on: ubuntu-latest |
| 100 | + steps: |
| 101 | + - uses: actions/checkout@v2 |
| 102 | + # Skip this if the PR has the skipReleaseNotes label or if it's a merge to other than main. |
| 103 | + if: ${{!contains(github.event.pull_request.labels.*.name, env.skipReleaseNotesLabel) && (github.event.pull_request.base.ref == 'main')}} |
| 104 | + with: |
| 105 | + fetch-depth: 0 |
| 106 | + submodules: false |
| 107 | + - name: Check whether release notes have been updated |
| 108 | + # Skip this if the PR has the skipReleaseNotes label or if it's a merge to other than main. |
| 109 | + if: ${{!contains(github.event.pull_request.labels.*.name, env.skipReleaseNotesLabel) && (github.event.pull_request.base.ref == 'main')}} |
| 110 | + run: | |
| 111 | + set -e |
| 112 | + # Filename to check. |
| 113 | + README_FILE=release_build_files/readme.md |
| 114 | + # Determine the github merge base - same logic as integration_tests.yml |
| 115 | + # "git merge-base main branch_name" will give the common ancestor of both branches. |
| 116 | + MERGE_BASE=$(git merge-base origin/${{github.event.pull_request.head.ref}} origin/${{github.event.pull_request.base.ref}} || true) |
| 117 | + # If MERGE_BASE can't be determined, ignore this check, something odd is going on. |
| 118 | + if [[ -n "${MERGE_BASE}" ]]; then |
| 119 | + DIFF_RESULT=$(git diff --name-only "origin/${{github.event.pull_request.head.ref}}..${MERGE_BASE}" -- "${README_FILE}") |
| 120 | + if [[ "${DIFF_RESULT}" != "${README_FILE}" ]]; then |
| 121 | + echo "::error ::Please update release notes (${README_FILE}) or add '${{env.skipReleaseNotesLabel}}' label." |
| 122 | + exit 1 |
| 123 | + fi |
| 124 | + fi |
| 125 | + |
0 commit comments