Quantcast
Channel: User HolyBlackCat - Stack Overflow
Viewing all articles
Browse latest Browse all 1287

Answer by HolyBlackCat for How to write a If else condition in github action workflow yaml file?

$
0
0

I came here looking how to disable the entire.yml file with a single condition.

Adding the conditions to each job individually is not feasible, because e.g. in a pull request, it spams a "job skipped" indicator for each skipped job, which is annoying (and duplicating the conditions is annoying).

The solution is to create a second.yml file, and conditionally run the primary file from it. Like this:

on:  # Your triggers here, not in the main file.jobs:  test-pip-build:    if: YOUR_CONDITION    uses: ./.github/workflows/your_file.yml

Viewing all articles
Browse latest Browse all 1287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>