| name: Release Notes | |
| on: | |
| pull_request: | |
| types: [synchronize, opened, reopened, labeled, unlabeled] | |
| paths: | |
| - "**/*.dart" | |
| env: | |
| CURRENT_RELEASE_FILE_PATH: packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md | |
| jobs: | |
| release-preparedness: | |
| if: ${{ !contains(github.event.*.labels.*.name, 'release-notes-not-required') && github.event.pull_request.user.login != 'DartDevtoolWorkflowBot' }} | |
| runs-on: ubuntu-latest | |
| name: Verify PR Release Note Requirements | |
| steps: | |
| - name: Get Pull Request Number | |
| id: get-pull-request-number | |
| run: | | |
| PULL_REQUEST_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") | |
| echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> $GITHUB_OUTPUT | |
| - name: Check if we have modified release note file | |
| id: get-modified-files | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PULL_NUMBER: ${{steps.get-pull-request-number.outputs.PULL_REQUEST_NUMBER}} | |
| run: | | |
| FILES_RESPONSE=$(gh api --paginate /repos/$GITHUB_REPOSITORY/pulls/$PULL_NUMBER/files) | |
| HAS_CHANGED_RELEASE_NOTES=$(echo "$FILES_RESPONSE" | jq -r --arg path "$CURRENT_RELEASE_FILE_PATH" '[.[].filename == $path] | any') | |
| echo "HAS_CHANGED_RELEASE_NOTES=$HAS_CHANGED_RELEASE_NOTES" >> $GITHUB_OUTPUT | |
| - name: Check Release Preparedness requirements | |
| env: | |
| HAS_CHANGED_RELEASE_NOTES: ${{steps.get-modified-files.outputs.HAS_CHANGED_RELEASE_NOTES}} | |
| run: | | |
| if [ "$HAS_CHANGED_RELEASE_NOTES" != "true" ] ; then | |
| echo "Release Preparedness check failed" | |
| echo "::error title='Release Notes were not modified'::Please add a release note entry to $CURRENT_RELEASE_FILE_PATH or add the 'release-notes-not-required' label." | |
| exit 1 | |
| fi |