Skip to content

Commit

Permalink
Correct spec paths when generating summary
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia committed May 21, 2024
1 parent 671713f commit 91655f7
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/analyze-pr-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,38 +111,37 @@ jobs:
shell: bash -eo pipefail {0}
run: npm install --global @pb33f/openapi-changes

- name: Generate HTML Report
- name: Generate API Changes HTML Report
shell: bash -eo pipefail {0}
run: openapi-changes html-report --no-logo --no-color $BEFORE_SPEC $AFTER_SPEC

- name: Upload HTML Report
- name: Upload API Changes HTML Report
id: upload-report
uses: actions/upload-artifact@v4
with:
name: changes-report
name: api-changes-report
path: |
report.html
/tmp/opensearch-openapi-*.yaml
- name: Generate Summary
- name: Generate API Changes Summary
shell: bash -eo pipefail {0}
run: |
if ! openapi-changes summary --no-logo --no-color --markdown /tmp/opensearch-openapi-ORIGINAL.yaml /tmp/opensearch-openapi-CHANGED.yaml >output.md ; then
if ! openapi-changes summary --no-logo --no-color --markdown $BEFORE_SPEC $AFTER_SPEC >output.md ; then
if ! grep -q 'breaking changes discovered' output.md ; then
cat output.md >/dev/stderr
exit 1
fi
fi
gawk -v AFTER_SHA="${AFTER_SHA}" -v REPORT_URL="${REPORT_URL}" '
gawk '
BEGIN {
print "### API Changes Summary"
RS = "(\r|\n|\r\n)"
WAS_BLANK = 0
HAD_CHANGES = 0
}
/^starting work/ || /^Building original model/ || /^SPEC: extracted/ || /^ERROR: breaking/ || /^DONE: completed/ {
/^starting work/ || /^Building original model/ || /^Date:/ || /^SPEC:/ || /^ERROR:/ || /^DONE:/ {
next
}
Expand All @@ -158,19 +157,15 @@ jobs:
{
HAD_CHANGES = 1
sub(/Commit: New:/, "Commit: " AFTER_SHA ", New:")
print
}
END {
if (!HAD_CHANGES) {
print "Commit: " AFTER_SHA ", **NO CHANGES**\n"
print "**NO CHANGES**\n"
}
print "\nFull Report: " REPORT_URL
}
' output.md | tee changes-summary.md
env:
REPORT_URL: ${{ steps.upload-report.outputs.artifact-url }}
- name: Upload Summary
uses: actions/upload-artifact@v4
Expand Down

0 comments on commit 91655f7

Please sign in to comment.