Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci): add draft check in the workflow yaml #8396

Merged
merged 5 commits into from
Oct 28, 2022

Conversation

all-seeing-code
Copy link
Contributor

@all-seeing-code all-seeing-code commented Oct 28, 2022

Problem

Currently the tests runs on draft PR as well which is waste of resources.

Solution

Add a if: ! github.event.pull_request.draft check to prevent GH runs on draft PRs. Reference: https://stackoverflow.com/questions/68349031/only-run-actions-on-non-draft-pull-request

@CLAassistant
Copy link

CLAassistant commented Oct 28, 2022

CLA assistant check
All committers have signed the CLA.

@all-seeing-code all-seeing-code changed the title Add draft check in the workflow yaml chore: Add draft check in the workflow yaml Oct 28, 2022
@all-seeing-code all-seeing-code marked this pull request as ready for review October 28, 2022 13:05
@skrdgraph
Copy link
Contributor

Referencing this issue https://github.com/dgraph-io/projects/issues/14

@skrdgraph skrdgraph changed the title chore: Add draft check in the workflow yaml fix(ci): add draft check in the workflow yaml Oct 28, 2022
@all-seeing-code all-seeing-code marked this pull request as draft October 28, 2022 13:18
@all-seeing-code all-seeing-code marked this pull request as ready for review October 28, 2022 13:18
@skrdgraph
Copy link
Contributor

@anurags92 as I was seeing this, an edge case came to my mind.

  • our triggers for CI is a commit*
  • a transition event from draft to review on a PR, should that be a trigger as well?

I am not sure if this PR actually forces a run after a transition. It would probably trigger the run when a commit is made on a ready-for-review PR. I am not sure how this works. Leaving my thoughts from observation (I need to read the docs for better understanding)

@all-seeing-code
Copy link
Contributor Author

@anurags92 as I was seeing this, an edge case came to my mind.

* our triggers for CI is a commit*

* a transition event from draft to review on a PR, should that be a trigger as well?

I am not sure if this PR actually forces a run after a transition. It would probably trigger the run when a commit is made on a ready-for-review PR. I am not sure how this works. Leaving my thoughts from observation (I need to read the docs for better understanding)

See my commit b4feeca which handles exactly this.

@all-seeing-code all-seeing-code marked this pull request as draft October 28, 2022 13:31
@all-seeing-code all-seeing-code marked this pull request as ready for review October 28, 2022 13:31
@all-seeing-code
Copy link
Contributor Author

@skrdgraph
By default following events are triggers for a PR:

      - opened
      - reopened
      - synchronize

I have added ready_for_review as well for precisely the reason that you mentioned. It would trigger CI when someone marks their PR as ready to review.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 37.18% when pulling 995992a on anurags92/draft-pr-no-tests into c6ca6bd on main.

@skrdgraph skrdgraph merged commit f2f040f into main Oct 28, 2022
@skrdgraph skrdgraph deleted the anurags92/draft-pr-no-tests branch October 28, 2022 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants