Skip to content

Instantly share code, notes, and snippets.

@myobie
Last active July 31, 2024 12:51
Show Gist options
  • Save myobie/671d2f2a1e503efa0c05e7b865c26a9d to your computer and use it in GitHub Desktop.
Save myobie/671d2f2a1e503efa0c05e7b865c26a9d to your computer and use it in GitHub Desktop.
Don't run GitHub Actions for pull requests that are drafts
on:
push:
branches:
- master
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
jobs:
test:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
steps:
- uses: actions/checkout@v2
- run: …
@mikamikaWolt
Copy link

Unfortunately, it will run workflow on Push to PR in Draft because of "synchronize" type.
Types parameters works as OR, not "AND".

@myobie
Copy link
Author

myobie commented Apr 19, 2022

@mikamikaWolt are you sure the if statement on line 15 isn't working? The event type should not be push, so then it will only run if it's not in draft. Last I tried this, it worked for me, but it also has been a while...

@dnlo
Copy link

dnlo commented May 25, 2022

@myobie if works, it skips on draft PR push
Thanks for the gist man

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment