Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
exoego committed Apr 28, 2024
1 parent 334a65d commit 545e65f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
14 changes: 2 additions & 12 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,6 @@ runs:
name: bundle
path: ${{ inputs.analyze_directory }}/bundle_analysis.json

- name: Get Comment Body
shell: bash
id: get-comment-body
if: success() && github.event.number
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
run: |
echo "body<<EOF" >> $GITHUB_OUTPUT
echo "$(cat ${{ inputs.analyze_directory }}/bundle_analysis_comment.txt)" >> $GITHUB_OUTPUT
echo EOF >> $GITHUB_OUTPUT
- name: Find Comment
uses: peter-evans/find-comment@v3
if: success() && github.event.number
Expand All @@ -111,13 +101,13 @@ runs:
if: success() && github.event.number && steps.fc.outputs.comment-id == 0
with:
issue-number: ${{ github.event.number }}
body: ${{ steps.get-comment-body.outputs.body }}
body-path: ${{ inputs.analyze_directory }}/bundle_analysis_comment.txt

- name: Update Comment
uses: peter-evans/create-or-update-comment@v4
if: success() && github.event.number && steps.fc.outputs.comment-id != 0
with:
issue-number: ${{ github.event.number }}
body: ${{ steps.get-comment-body.outputs.body }}
body-path: ${{ inputs.analyze_directory }}/bundle_analysis_comment.txt
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
7 changes: 3 additions & 4 deletions src/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,15 @@ This analysis was generated by [esbuild-bundle-analyzer](https://github.com/exoe
if (!hasAnyChange && input.skipCommentIfEmpty) {
output = "";
}

// Log mostly for testing and debugging.
// This will show up in the github actions console.
console.dir({
input,
hasAnyChange,
output,
});

// log the output, mostly for testing and debugging. this will show up in the
// github actions console.
console.log(output);

// Write the output to a file which is later read in
// as comment contents by the actions workflow.
fs.mkdirSync(path.join(process.cwd(), input.analyzerDirectory), {
Expand Down

0 comments on commit 545e65f

Please sign in to comment.