Skip to content

Commit

Permalink
Improve Dry Run Output (#64)
Browse files Browse the repository at this point in the history
* remove dry-run

* add reports.sh

* add line breaks

* add pkdiff steps

* use npx

* add shell

* fix typo

* remove bash

* use |

* use node 16

* remove npx

* add shell

* add newline

* use variable

* report (singular)

* upload-artifact (singular)
  • Loading branch information
rickycodes authored Apr 30, 2024
1 parent d9462c8 commit 0e5aa50
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
14 changes: 14 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ runs:
env:
YARN_NPM_AUTH_TOKEN: ${{ inputs.npm-token }}
PUBLISH_NPM_TAG: ${{ inputs.npm-tag }}
- id: install-pkdiff
shell: bash
run: npm i -g pkdiff
- id: generate-report
shell: bash
if: inputs.npm-token == ''
run: ${{ github.action_path }}/scripts/report.sh
- id: upload-artifact
if: inputs.npm-token == ''
uses: actions/upload-artifact@v4
with:
path: |
/tmp/*.tgz
/tmp/*.html
- id: name-version
shell: bash
if: inputs.slack-webhook-url != ''
Expand Down
4 changes: 2 additions & 2 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ set -e
set -o pipefail

if [[ -z $YARN_NPM_AUTH_TOKEN ]]; then
echo "Notice: 'npm-token' not set. Running 'yarn pack --dry-run'."
yarn pack --dry-run
echo "Notice: 'npm-token' not set. Running 'yarn pack'."
yarn pack --out /tmp/%s-%v.tgz
exit 0
fi

Expand Down
21 changes: 21 additions & 0 deletions scripts/report.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

set -x
set -e
set -o pipefail

directory="/tmp"

for file in "$directory"/*.tgz; do
if [ -f "$file" ]; then
echo "Processing $file"
basename=$(basename "$file")
name="${basename%-*}"
name_with_slash="${name/-//}"
echo "$name_with_slash"
pkdiff "$name_with_slash@latest" "$file" \
--no-exit-code \
--no-open \
--output "$directory/$basename.html"
fi
done

0 comments on commit 0e5aa50

Please sign in to comment.