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

Extend "on" with possibility to ignore forks (run only for the original repo) #859

Closed
famod opened this issue Dec 14, 2020 · 8 comments
Closed
Labels
Actions Feature Feature requires both runner, pipelines service and launch changes enhancement New feature or request

Comments

@famod
Copy link

famod commented Dec 14, 2020

Describe the enhancement
Enhancement of the on directive to tigger a workflow only for the original repo, not a fork of it.

Code Snippet
One idea:

on:
  push:
    repositories:
      - 'quarkusio/quarkus'

or more specifically (but less flexible):

on:
  push:
    ignore-forks: true

or similar.

Additional information

There are a couple of workflows over at https://github.com/quarkusio/quarkus which just don't make sense to run for forks.

Right now those workflows are using per job:

  linux-jvm-tests:
    name: JVM Tests - JDK ${{matrix.java.name}}
    runs-on: ubuntu-latest
    # Skip master in forks
    if: "github.repository == 'quarkusio/quarkus'

This is rather verbose and easy to forget for workflows consisting of multiple jobs.
Furthermore, it results in many skipped actions entries in forks, e.g. "Cleanup Duplicate CI Runs" here: https://github.com/famod/quarkus/actions

Disabling actions in forks is not an option for Quarkus, since Quarkus contributors are asked to wait for CI in their forks before creating PRs.

PS: Not sure this is the right report for syntax enhancements. 🤔 If not, please point me in the right direction. Thanks!

@famod famod added the enhancement New feature or request label Dec 14, 2020
@famod
Copy link
Author

famod commented Jan 12, 2021

There is now another new job in Quarkus that shall run in forks only. A consistent solution for that would be ignore-repositories (accompanying repositories).

The more specific but less flexible alternative would require something like ignore-origin (accompanying ignore-forks) but that leaves the question about what actually is the "origin" (which is not an ideal name by any means) in case a repo is forked and then that fork is forked again.

@TingluoHuang TingluoHuang added the Actions Feature Feature requires both runner, pipelines service and launch changes label Apr 23, 2021
@hellwolf
Copy link

I would love this feature for our project.

@ethomson
Copy link
Contributor

My understanding here is that you have some jobs that you want to run in forks and some jobs that you want to run in the main CI?

This seems like a possibly useful addition. However, suggestions for GitHub Actions functionality belong in the GitHub feedback forum, where the product managers and engineers will be able to review them. This repository is really only focused on the runner application, which is a very small component of GitHub Actions. If you could open this issue there, that would be very helpful for us! 😄

In the meantime, I'm closing this issue here. Thanks again!

@famod
Copy link
Author

famod commented Dec 19, 2021

@ethomson thanks for letting me know. I created a discussion: community/community#9098

@sarbull
Copy link

sarbull commented Oct 25, 2022

you can condition your pipeline to run only on specific repository like this https://github.com/odpi/egeria-js-commons/blob/main/.github/workflows/dist.yml#L10

@brettcannon
Copy link

you can condition your pipeline to run only on specific repository like this https://github.com/odpi/egeria-js-commons/blob/main/.github/workflows/dist.yml#L10

I believe a (new) permalink for this would be https://github.com/odpi/egeria-js-commons/blob/9a4ce59c2713751e64ac65f276ca01b8b8a2f873/.github/workflows/publish.yml#L10

@famod
Copy link
Author

famod commented Jan 30, 2023

I aware of that condition workaround but as mentioned initially, this has to be added for each job and cannot be specified once for an entire workflow (which might contain many jobs).

@round-corgi
Copy link

We run many workflows internally via private forks, where the pipeline only gets executed on pull request or on push to master.

We'd love this functionality as well.

As it stands, job-specific conditional for github.repository or github.repository_owner will prevent the job itself from running. However, if someone updates their fork from master, the pipeline still executes and then fails to run, which has been annoying the devs since our move to Actions.

thkoch2001 added a commit to thkoch2001/yacy_search_server that referenced this issue Feb 13, 2023
I get scary emails from github about failed jobs for every commit pushed to my
yacy fork. But the jobs should not run on my forked repo in the first place.

This problem is not unique to yacy:
actions/runner#859

Alternatively every contributor could disable workflows in the settings of
their fork repo:
https://docs.github.com/en/actions/managing-workflow-runs/disabling-and-enabling-a-workflow
nftbty referenced this issue in xiaorouji/openwrt-passwall Apr 10, 2023
Add no package compilation
github-merge-queue bot pushed a commit to kurtosis-tech/kurtosis that referenced this issue Mar 6, 2024
## Description:

Prevent running `push-docs` and `release-please` jobs in forked
repositories. When syncing your fork with the main repository, these
jobs consistently fail.

![Screenshot 2024-03-04 at 08 53
54](https://github.com/kurtosis-tech/kurtosis/assets/28714795/4e5de47b-0080-4af4-8bd5-2d47bac660f3)


## Is this change user facing?
NO

## References (if applicable):

actions/runner#859
github-merge-queue bot pushed a commit to kurtosis-tech/kurtosis that referenced this issue Mar 7, 2024
## Description:

Prevent running `push-docs` and `release-please` jobs in forked
repositories. When syncing your fork with the main repository, these
jobs consistently fail.

![Screenshot 2024-03-04 at 08 53
54](https://github.com/kurtosis-tech/kurtosis/assets/28714795/4e5de47b-0080-4af4-8bd5-2d47bac660f3)


## Is this change user facing?
NO

## References (if applicable):

actions/runner#859
github-merge-queue bot pushed a commit to kurtosis-tech/kurtosis that referenced this issue Mar 8, 2024
## Description:

Prevent running `push-docs` and `release-please` jobs in forked
repositories. When syncing your fork with the main repository, these
jobs consistently fail.

![Screenshot 2024-03-04 at 08 53
54](https://github.com/kurtosis-tech/kurtosis/assets/28714795/4e5de47b-0080-4af4-8bd5-2d47bac660f3)


## Is this change user facing?
NO

## References (if applicable):

actions/runner#859
github-merge-queue bot pushed a commit to kurtosis-tech/kurtosis that referenced this issue Mar 8, 2024
## Description:

Prevent running `push-docs` and `release-please` jobs in forked
repositories. When syncing your fork with the main repository, these
jobs consistently fail.

![Screenshot 2024-03-04 at 08 53
54](https://github.com/kurtosis-tech/kurtosis/assets/28714795/4e5de47b-0080-4af4-8bd5-2d47bac660f3)


## Is this change user facing?
NO

## References (if applicable):

actions/runner#859
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Feature Feature requires both runner, pipelines service and launch changes enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants