Skip to content

Commit

Permalink
Add diff to summary (#3968)
Browse files Browse the repository at this point in the history
* Add diff to summary

* close details

* Use github-script

* move it

* more space

* Add to generator as well

* Fix category
  • Loading branch information
ludeeus authored Aug 13, 2024
1 parent 88fc1c0 commit ae25c06
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/generate-hacs-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,19 @@ jobs:
- name: Generate diff
run: |
diff -u outputdata/diff/${{ matrix.category }}_before.json outputdata/diff/${{ matrix.category }}_after.json > outputdata/diff/${{ matrix.category }}.diff || true
cat outputdata/diff/${{ matrix.category }}.diff
- name: Upload diff
uses: actions/[email protected]
env:
CATEGORY: ${{ matrix.category }}
with:
script: |
const fs = require('fs');
const diffContents = fs.readFileSync(`outputdata/diff/${process.env.CATEGORY}.diff`);
core.summary.addDetails(`${process.env.CATEGORY}.diff contents`, `\n\n\`\`\`diff\n${diffContents}\`\`\`\n\n`)
core.summary.write()
- name: Upload artifacts
uses: actions/[email protected]
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@ jobs:
diff -u outputdata/diff/${{ matrix.entry.category }}_before.json outputdata/diff/${{ matrix.entry.category }}_after.json > outputdata/diff/${{ matrix.entry.category }}.diff || true
cat outputdata/diff/${{ matrix.entry.category }}.diff
- name: Upload diff
uses: actions/[email protected]
env:
CATEGORY: ${{ matrix.entry.category }}
with:
script: |
const fs = require('fs');
const diffContents = fs.readFileSync(`outputdata/diff/${process.env.CATEGORY}.diff`);
core.summary.addDetails(`${process.env.CATEGORY}.diff contents`, `\n\n\`\`\`diff\n${diffContents}\`\`\`\n\n`)
core.summary.write()
- name: Validate output with JQ
run: |
jq -c . outputdata/${{ matrix.entry.category }}/data.json
Expand Down

0 comments on commit ae25c06

Please sign in to comment.