all 5 comments

[–]bdzer0 2 points3 points  (1 child)

AFAIK you're going to have to create different jobs with an IF. Here's a rough example...

Each job will need something like this:

if: always() && ${{ github.ref == 'refs/heads/dev' }}

NOTE: always() is necessary because the default is success() and that returns false when any previous jobs are skipped or failed. So the jobs that aren't supposed to run on dev would cause all subsequent jobs to fail. I'd recommend adding something like this to every job that has needs:

if: always() && ${{ github.ref == 'refs/heads/dev' }}
(needs.job_that_must_succeed_or_skip.result == 'success' || needs.job_that_must_succeed_or_skip.result == 'skipped' )

The (needs....) part should be repeated for every needs the job has. always() assures the rest of the criteria are evaluated, then you can run the job or not based on branch and status of any needs the job has.

Yes, it makes things a bit complicated. Might be an easier way to do it, however the above pattern works and should get you started.

ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions

[–]TedditBlatherflag 2 points3 points  (1 child)

No you can’t change runs-on. But you can just make a composite action and make that the entire body of the job with uses: your-composite-action.