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

Ensure that CI is executed for PRs from forked repositories. #112

Merged

Conversation

madogiwa0124
Copy link
Contributor

@madogiwa0124 madogiwa0124 commented Dec 21, 2021

This is a PR to changed to CI trigger from push only.

How about this PR?

Description

Currently, CI is only triggered by push, so PR from a forked repository will not run CI.
Therefore, added pull_request in on.

Also, if simply add pull_request, it will be executed twice with push,
so we modified push to be executed only in the master branch.

related: #109

Test

In my repository, I have confirmed that CI runs "when the PR is created" and "when it is merged into master".

References

This will prevent builds from happening twice when somebody opens a pull request against master and then pushes updates to their branch. For example:

on:
 push:
   branches:
   - master
 pull_request:
   branches:
   - master

https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662/2

I didn't feel it was necessary to limit it to those aimed at the master branch, so I made sure to run CI on all pull requests.

If it is better to focus only on master, I will modify it as per the sample 😃

Currently, CI is only triggered by push, so PR from a forked repository will not run CI.
Therefore, added `pull_request` to `on`.

Also, if simply add `pull_request`, it will be executed twice with `push`,
so we modified `push` to be executed only in the `master` branch.

related: mikker#109
@rickychilcott
Copy link
Collaborator

Thanks. I've run into this myself before. This is the right approach. Thank you!

@rickychilcott rickychilcott merged commit 42d41a8 into mikker:master Dec 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants