Skip to content

Restrict builds on push events to master - #11054

Merged
pllim merged 1 commit into
astropy:masterfrom
saimn:ga-branch-event
Nov 17, 2020
Merged

pllim merged 1 commit into
astropy:masterfrom
saimn:ga-branch-event

Conversation

@saimn

@saimn saimn commented Nov 16, 2020

Copy link
Copy Markdown
Contributor

This is to avoid running Actions twice, when pushing a branch and opening a PR.

This double build was also happening sometimes with Travis when pushing a branch directly on the repo and could be avoided with a

branches:
  only:
  - master

block.

The difference with Actions is that it is also activated by default on forks, so when pushing a branch to a fork and opening a PR the workflow is run twice, on the fork (push event) and on the main repo (pull_request event).

Note: we should allow the maintenance branch if we backport Actions (#11050).

@saimn
saimn requested a review from pllim November 16, 2020 23:14
@pllim pllim added this to the v4.3 milestone Nov 17, 2020

@pllim pllim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would not prevent Actions from running on a fork in the following situations:

  • Someone opening PR from their own master branch on the fork. It happens more often than I like (sometimes even from seasoned contributors) but since we already tell people not to do that in the docs, fixing it is out of scope here as it would be a dev doc fix or contributor education more than anything else.
  • PR to a PR branch on a fork. But maybe we want the CI to run in that case, so nothing to fix here as well.

Thanks!

@pllim
pllim merged commit 683ab76 into astropy:master Nov 17, 2020
@pllim pllim mentioned this pull request Nov 17, 2020
18 tasks done
@saimn
saimn deleted the ga-branch-event branch November 17, 2020 15:24
@saimn

saimn commented Nov 17, 2020

Copy link
Copy Markdown
Contributor Author

Yes indeed. And another annoyance is that the cron builds run on forks too.

@pllim

pllim commented Nov 17, 2020

Copy link
Copy Markdown
Member

I think I remember getting a message from Actions that they automatically cancel cron jobs on forks now.

@pllim

pllim commented Nov 17, 2020

Copy link
Copy Markdown
Member

And looks like every contributor who forked has option to disable Actions altogether on their forks: https://github.community/t/stop-github-actions-running-on-a-fork/17965/2

Should we recommend this in contributing guide or something?

tepickering added a commit to tepickering/package-template that referenced this pull request Nov 17, 2020
tepickering added a commit to tepickering/PypeIt that referenced this pull request Nov 17, 2020
@saimn

saimn commented Nov 18, 2020

Copy link
Copy Markdown
Contributor Author

The daily cron has been running on my fork: https://github.com/saimn/astropy/actions/runs/367311810

Yes, you deactivate it on the fork, but I guess too few people would do it. So maybe instead we can skip explicitly the cron workflows if not running on the main repo.

@pllim

pllim commented Nov 18, 2020

Copy link
Copy Markdown
Member

Hmm. Maybe because I haven't sync-ed my fork for some time? 🤷

So maybe instead we can skip explicitly the cron workflows if not running on the main repo.

That would be nice, but how? I only find https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/disabling-or-limiting-github-actions-for-a-repository that uses the GitHub UI.

@saimn

saimn commented Nov 18, 2020

Copy link
Copy Markdown
Contributor Author

#11056 should do it 🤞

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants