mirror of
https://github.com/actions/add-to-project.git
synced 2025-12-13 05:27:56 +00:00
Improve check-dist output
This commit is contained in:
14
.github/workflows/check-dist.yml
vendored
14
.github/workflows/check-dist.yml
vendored
@@ -15,6 +15,11 @@ on:
|
|||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
|
|
||||||
|
env:
|
||||||
|
# A pipe-separated array of files to ignore when comparing the expected and actual dist/ directories,
|
||||||
|
# which are used as a regular expression filter in the `grep` command.
|
||||||
|
FILES_TO_IGNORE: 'index.js.map|sourcemap-register.js'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-dist:
|
check-dist:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -38,9 +43,12 @@ jobs:
|
|||||||
|
|
||||||
- name: Compare the expected and actual dist/ directories
|
- name: Compare the expected and actual dist/ directories
|
||||||
run: |
|
run: |
|
||||||
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
|
CHANGED_FILES=$(git diff --ignore-space-at-eol --name-only dist/ | grep -vE "$FILES_TO_IGNORE")
|
||||||
echo "Detected uncommitted changes after build. See status below:"
|
if [ -n "$CHANGED_FILES" ]; then
|
||||||
git diff
|
echo "Detected uncommitted changes after build (see diff output below)." >&2
|
||||||
|
echo "This indicates that the dist/ directory is out of sync with the checked-in index.js." >&2
|
||||||
|
# Run `git diff` for each line/file in $CHANGED_FILES:
|
||||||
|
echo "$CHANGED_FILES" | xargs -I {} git diff --ignore-space-at-eol --text -- {}
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
id: diff
|
id: diff
|
||||||
|
|||||||
Reference in New Issue
Block a user