mikker / passwordless

🗝 Authentication for your Rails app without the icky-ness of passwords
MIT License
1.26k stars 87 forks source link

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

Closed madogiwa0124 closed 2 years ago

madogiwa0124 commented 2 years ago

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: https://github.com/mikker/passwordless/pull/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 😃

rickychilcott commented 2 years ago

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