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

Allow Github Actions to be run on non-master branch #65

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dolfinus
Copy link

Hi.

I've added a small fix to your Github Actions workflow definition - now it will be executed while pushing commit to any branch instead of just master.
This allows users like me create multiple pull requests from different branches of their fork repos to the master branch of your repo, and still be able to see if something is wrong with the source code.

@mgedmin
Copy link
Owner

mgedmin commented Aug 11, 2021

This should not be necessary -- when you create a pull request, the 'on: pull_request' trigger performs the build.

What will happen if I merge this, any PR created from a branch in this repository will have all the jobs doubled: once for the pull_request trigger, and once for the branch trigger. I don't want that.

@mgedmin mgedmin closed this Aug 11, 2021
@dolfinus
Copy link
Author

dolfinus commented Aug 12, 2021

Hi.

when you create a pull request, the 'on: pull_request' trigger performs the build.

Right, but it would not run workflow on a forked repo until I make a pull request. More than that, it will not be run until an author of the original repo will open this PR and approve a workflow execution.
This is a way to prevent executing workflows with cryptocurrency miners introduced by Github on April 2021.

Because of that limiting a workflow run with a specific branch is not a best option. For example, I've created a pull request #64 and I has been waited for 2 weeks for the workflow to be approved by you just to ensure that my changes are correct. And only after workflow has been executed I discovered that one of steps failed.

any PR created from a branch in this repository will have all the jobs doubled

Regarding the issue of executing a workflow twice when a PR is created within the same repo, there are other ways to prevent that.
For example, I'm using fkirc/skip-duplicate-actions action:
https://github.com/dolfinus/arkenston-backend/blob/4f1f30513ec2c8c1532986141b9e10451fe9c556/.github/workflows/test.yml#L10-L29

It prevents workflow from being run if there is another copy of workflow which has been triggered by the same commit.

@mgedmin
Copy link
Owner

mgedmin commented Aug 12, 2021

Ooh, the skipping of the duplicate action thing sounds interesting. I don't currently have the energy to investigate it (or review the long-standing open PRs, sorry about that, I'm trying!). Would you mind amending this PR so I can see what the result looks like?

@mgedmin mgedmin reopened this Aug 12, 2021
@mgedmin
Copy link
Owner

mgedmin commented Aug 12, 2021

Hm, actually, to really see what it would look like, I think I have to add you as a collaborator to this repo, so you can create branches in it. Otherwise there's no duplicates to hide, right?

@dolfinus dolfinus force-pushed the master branch 2 times, most recently from 08d6e04 to 4aa3d54 Compare August 23, 2021 18:34
@dolfinus dolfinus force-pushed the master branch 4 times, most recently from 91485a1 to f40a95c Compare December 16, 2021 09:18
@dolfinus
Copy link
Author

dolfinus commented Dec 16, 2021

Sorry for late response.

Would you mind amending this PR so I can see what the result looks like?

Of course not. I've amended this PR several times.

I think I have to add you as a collaborator to this repo, so you can create branches in it. Otherwise there's no duplicates to hide, right?

Actually, I can show you how it works on a forked repo.

For example, I've pushed a commit and then amended (without adding any changes) it and pushed again.
So workflow has been triggered by the first commit:
https://github.com/dolfinus/objgraph/actions/runs/1586725848
But next one has been skipped:
https://github.com/dolfinus/objgraph/actions/runs/1586726837
If there are some changes in the new commit, next build will not be skipped.

Also I've created a new branch and PR.
PR build was triggered successfully:
https://github.com/dolfinus/objgraph/actions/runs/1586753567
But duplicated one caused by commit has been skipped:
https://github.com/dolfinus/objgraph/actions/runs/1586753367

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.

2 participants