Skip to content

On push ⚙️

On push ⚙️ #5

Workflow file for this run

name: 'Schedule workflow run'
on:
push:
branches:
- main
paths:
- 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:
- prestashop
- shopware
- wordpress
jobs:
prepare:
runs-on: ubuntu-22.04
strategy:
matrix:
image:
- 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