Is it possible to disable a github action - preferably by setting a boolean value somewhere in the .yml file itself?
If you want to disable the Actions feature on your repository, and do not run any workflow on your repository, you can directly delete all the YAML files under .github/workflow from your repository.
And you also can disable GitHub Actions feature on repository level and Organization level.
To disable Actions on a specific repository, on the Settings tab of this repository, navigate to Actions , select Disable Actions for this repository.
To disable Actions on a specific Organization, navigate to Organization settings > Member privileges , select Disable Actions for the organization , this will disable Actions on all repositories in this Organization.
Reference this earlier reported ticket to get more details: https://github.community/t5/GitHub-Actions/how-do-I-get-rid-of-github-workflow/td-p/39568
If you want to skip executing an action when running your workflow, you can use the syntax jobs.<job_id>.steps.if to setup a condition to skip the step that executes the action.
Would still be great if I could disable a complete workflow (not just single steps) temporarily within the YML file by setting a boolean value.
You can disable it by “ignoring it always”, i.e.
on: push: branches-ignore: - '**'
Just move that workflow file elsewhere, e.g. from " .github/workflows/my_action.yml" to " .github/disabled-workflows/my_action.yml".
Two more options:
Keep the YAML file where it is, but change the file extension, e.g. from
.yaml.disabled. Only files which end with
.yamlare picked up by the system.
Use a per-job condition and unconditionally skip the jobs you don’t want:
jobs: <job-id>: name: ... if: false # always skip job
Downside: the workflow will still be started and report “This check was skipped”.
Another thing I tried is an empty array for which build matrix jobs to execute, like
strategy.matrix.build: . This is invalid, but because it is not allowed it will fail and report an error, which means the workflow won’t actually be executed as this is an early error. It still gets started and logged as failed however.