diff --git a/lint-release-notes/action.yaml b/lint-release-notes/action.yaml index 7207f74..3727192 100644 --- a/lint-release-notes/action.yaml +++ b/lint-release-notes/action.yaml @@ -64,6 +64,7 @@ runs: comment_id: ${{ steps.fc-release-notes.outputs.comment-id }} token: ${{ inputs.github-token }} - name: Comment release notes preview + id: release-notes-preview-comment uses: peter-evans/create-or-update-comment@v1 if: steps.release-notes-preview.outputs.new-release-notes != '' && steps.find-pull-request.outputs.number != '' with: @@ -111,7 +112,8 @@ runs: run: | set -e breaking_changes_file_missing=false - breaking_changes_file_default=false + breaking_changes_file_default_content=false + breaking_file_contents = "" if [ "${{ steps.release-notes-preview.outputs.new-release-published }}" = "true" ]; then echo "new release published" if [ "${{ steps.release-notes-preview.outputs.new-release-type }}" = "major" ]; then @@ -122,10 +124,11 @@ runs: echo "breaking change doc $file_path exists." expected_contents="Elaborate and add context to help the developer understand the changes" + breaking_file_contents=$(cat "$file_path") + if grep -Fq "$expected_contents" "$file_path"; then - echo "The file $file_path contains the expected contents." - else - echo "The file $file_path does not contain the expected contents." + echo "The file $file_path contains the default contents." + breaking_changes_file_default_content=false fi else echo "breaking change doc $file_path does not exist." @@ -136,6 +139,7 @@ runs: echo "Output: required=${breaking_changes_file_missing}" echo "required=${breaking_changes_file_missing}" >> $GITHUB_OUTPUT echo "default_content=${breaking_changes_file_default_content}" >> $GITHUB_OUTPUT + echo "breaking_file_contents=${breaking_file_contents}" >> $GITHUB_OUTPUT - name: Comment missing breaking changes doc uses: peter-evans/create-or-update-comment@v1 if: steps.breaking-changes-file.outputs.required == 'true' @@ -184,6 +188,15 @@ runs: --- + - name: Append breaking changes doc to release notes preview + uses: peter-evans/create-or-update-comment@v1 + if: steps.breaking-changes-file.outputs.default_content != '' + with: + comment-id: ${{ steps.release-notes-preview-comment.outputs.comment-id }} + body: | + ## Breaking changes documentation + ${{ steps.breaking-changes-file.outputs.breaking_file_contents }} + - name: Fail if we are checking for the breaking changes doc and it is missing if: steps.breaking-changes-file.outputs.required == 'true' shell: bash