Actionsflow #12009
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: Actionsflow | |
# event `repository_dispatch` with the type `webhook` is reserved by Actionsflow. | |
on: | |
schedule: | |
- cron: "0 * * * *" | |
push: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/actionsflow.yaml" | |
- "workflows/**" | |
repository_dispatch: | |
types: [webhook] | |
workflow_dispatch: | |
inputs: | |
include: | |
description: | | |
--include: workflow file filter | |
You can use glob format to filter your workflows. The default value | |
is empty value, meaning no filter will be applied. | |
required: false | |
default: "" | |
force: | |
description: "--force: whether force to run workflow (true or false)" | |
required: false | |
default: "false" | |
verbose: | |
description: "--verbose: debug workflow (true or false)" | |
required: false | |
default: "false" | |
jobs: | |
run: | |
runs-on: ["gha-home-ops"] | |
name: Run | |
concurrency: actionsflow | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run Actionsflow | |
uses: qlonik/actionsflow-action@v3 | |
with: | |
args: >- | |
build | |
${{ github.event.inputs.include != '' && format('--include "{0}"', github.event.inputs.include) || '' }} | |
-f ${{ github.event.inputs.force == 'true' && 'true' || 'false' }} | |
--verbose ${{ github.event.inputs.verbose == 'true' && 'true' || 'false' }} | |
json-secrets: ${{ toJSON(secrets) }} | |
json-github: ${{ toJSON(github) }} | |
- name: Check workflow files | |
id: check-workflow-files | |
run: |- | |
if [[ -d "./dist/workflows" && ! -z "$(ls -A ./dist/workflows)" ]]; then | |
echo "present=true" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Install act | |
if: ${{ steps.check-workflow-files.outputs.present == 'true' }} | |
run: curl -fsSL https://raw.githubusercontent.com/nektos/act/master/install.sh | bash -s -- -b ~/bin/ | |
- name: Run act | |
if: ${{ steps.check-workflow-files.outputs.present == 'true' }} | |
# Consider adding support for cache artifacts | |
# https://github.com/nektos/act/issues/329#issuecomment-1187246629 | |
# With this, cache action can be used in actionsflow workflows, caught by act | |
# and then uploaded to actual github cache | |
run: |- | |
~/bin/act \ | |
${{ github.event.inputs.verbose == 'true' && '--verbose' || '' }} \ | |
--bind \ | |
--eventpath ./dist/event.json \ | |
--workflows ./dist/workflows \ | |
--secret-file ./dist/.secrets \ | |
--env-file ./dist/.env \ | |
--platform ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest |