feat(node): set npm cache folder #4
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
name: '⏱️ Schedule workflow run' | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- images/node/** | |
- images/prestashop/** | |
- images/shopware/** | |
- images/wordpress/** | |
workflow_dispatch: | |
inputs: | |
image: | |
description: 'Image to schedule the workflow for (for testing purposes)' | |
required: true | |
type: choice | |
options: | |
- node | |
- prestashop | |
- shopware | |
- wordpress | |
jobs: | |
schedule: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
image: | |
- node | |
- prestashop | |
- shopware | |
- wordpress | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: tj-actions/changed-files@v45 | |
id: changed-files | |
if: inputs.image == '' | |
with: | |
files: 'images/${{ matrix.image }}/**' | |
- name: 'Prepare' | |
if: steps.changed-files.outputs.test_any_changed == 'true' || inputs.image == matrix.image | |
id: prepare | |
env: | |
IMAGE: ${{ matrix.image }} | |
shell: bash | |
#language=bash | |
run: | | |
echo "run=true" >> $GITHUB_OUTPUT | |
echo "filename=.lock-$IMAGE.txt" >> $GITHUB_OUTPUT | |
echo "artifact-name=workflow-lock-$IMAGE" >> $GITHUB_OUTPUT | |
- name: 'Check if lock file exists' | |
if: steps.prepare.outputs.run == 'true' | |
uses: ./.github/actions/check-artifact | |
id: check-lock | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: ${{ steps.prepare.outputs.artifact-name }} | |
- if: steps.prepare.outputs.run == 'true' && steps.check-lock.outputs.exists == 'true' | |
env: | |
IMAGE: ${{ matrix.image }} | |
shell: bash | |
#language=bash | |
run: | | |
echo "⏱️ There was already a run scheduled for \`$IMAGE\`." >> $GITHUB_STEP_SUMMARY | |
- name: 'Create lock file' | |
if: steps.prepare.outputs.run == 'true' && steps.check-lock.outputs.exists == 'false' | |
env: | |
FILENAME: ${{ steps.prepare.outputs.filename }} | |
shell: bash | |
#language=bash | |
run: | | |
echo "$(date)" > "$FILENAME" | |
- name: 'Upload lock artifact' | |
uses: actions/upload-artifact@v4 | |
if: steps.prepare.outputs.run == 'true' && steps.check-lock.outputs.exists == 'false' | |
with: | |
if-no-files-found: error | |
include-hidden-files: true | |
name: ${{ steps.prepare.outputs.artifact-name}} | |
path: ${{ steps.prepare.outputs.filename }} | |
- if: steps.prepare.outputs.run == 'true' && steps.check-lock.outputs.exists == 'false' | |
env: | |
IMAGE: ${{ matrix.image }} | |
shell: bash | |
#language=bash | |
run: | | |
echo "✅ A run for \`$IMAGE\` was scheduled." >> $GITHUB_STEP_SUMMARY | |
notify-on-failure: | |
needs: | |
- schedule | |
if: always() && contains(needs.*.result, 'failure') | |
uses: myparcelnl/actions/.github/workflows/notify-on-failure.yml@v4 | |
secrets: inherit |