Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Dry Run Output #64

Merged
merged 18 commits into from
Apr 30, 2024
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
Loading