Bump actions/upload-artifact from 4.3.4 to 4.4.0 in /.github/workflows #614
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# `dist/index.js` is a special file in Actions. | |
# When you reference an action with `uses:` in a workflow, | |
# `index.js` is the code that will run. | |
# For our project, we generate this file through a build process from other source files. | |
# We need to make sure the checked-in `index.js` actually matches what we expect it to be. | |
name: Check dist folder contents | |
on: | |
push: | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
check-dist: | |
permissions: | |
contents: write # for Git to git push | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set Node.js 16.x | |
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | |
with: | |
node-version: 16.x | |
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: ${{ runner.os }}-node- | |
- name: Install dependencies | |
run: npm ci | |
- name: Rebuild the dist/ directory | |
run: | | |
npm run all | |
- name: Double check Actor | |
run: | | |
echo "Actor: ${{ github.actor }}" | |
- name: Update dist folder on Dependabot PR | |
if: ${{ github.actor == 'dependabot[bot]' }} | |
run: | | |
echo "Actor: ${{ github.actor }}" | |
if [[ $(git status --porcelain) ]]; then | |
echo "There are uncommitted changes in the dist/ directory." | |
git config --global user.email "[email protected]" | |
git config --global user.name "Dependabot" | |
git add dist/* | |
git commit -m "Update dist" | |
git push origin main | |
fi | |
- name: Compare the expected and actual dist/ directories | |
run: | | |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then | |
echo "Detected uncommitted changes after build. See status below:" | |
git diff | |
exit 1 | |
fi | |
id: diff | |
# If index.js was different than expected, upload the expected version as an artifact | |
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
if: ${{ failure() && steps.diff.conclusion == 'failure' }} | |
with: | |
name: dist | |
path: dist/ |