I am trying to set up my workflow so it doesn’t run when opening/synching/reopening pull requests that are marked as draft.
I have found that I can use
if: github.event.pull_request.draft == false
on my job, but it will still run for a few seconds, and “fail”, leaving a red X on every commit on the PR until it is marked ready for reveiw.
I could maybe add a dummy-job that has
if: github.event.pull_request.draft == true
on it, and just echo something, but it will still run for a few seconds though.
My test-workfow so far looks like this:
name: Deploy test
on:
pull_request:
branches: [master]
types: [synchronize, opened, reopened, ready_for_review]
jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
timeout-minutes: 10
steps:
- uses: actions/checkout@v1
- name: Run all the stuff to set up my site and run tests
run: set_up_site
draft-build:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == true
timeout-minutes: 1
steps:
- name: Run a one-line script
run: echo Draft PR, you are good.
Will those seconds be added up and billed? Is there another or better way of getting around this?