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

document some of the pitfalls of using private or internal reusable workflows in a public repo #35735

Open
1 task done
jsoref opened this issue Dec 20, 2024 · 5 comments
Open
1 task done
Labels
actions This issue or pull request should be reviewed by the docs actions team content This issue or pull request belongs to the Docs Content team SME reviewed An SME has reviewed this issue/PR

Comments

@jsoref
Copy link
Contributor

jsoref commented Dec 20, 2024

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_iduses

What part(s) of the article would you like to see updated?

Add a warning

Warning

If you use uses: my-org/other-repo/.github/actions/shared-action@main then anyone who would trigger the workflow (as determined by on: ... conditions) especially in forks, but quite likely not limited to forks and doesn't have access to your my-org/other-repo repository will encounter an unfixable error of this form:

Invalid workflow file: .github/workflows/moda-ci.yaml#L86
error parsing called workflow ".github/workflows/moda-ci.yaml" -> "github/internal-actions/.github/workflows/docker_security.yml@main" : workflow was not found. See https://docs.github.com/actions/learn-github-actions/reusing-workflows#access-to-reusable-workflows for more information.

It's possible to avoid this by using a combination of a workflow_call with a jobs: / if: condition that guards against the user from tripping on the problem e.g. ${{ github.repository == 'github/docs-internal' }} and then have the on: workflow_call on the internal side be responsible for using the reusable workflow.

Additional information

@jsoref jsoref added the content This issue or pull request belongs to the Docs Content team label Dec 20, 2024
@github-actions github-actions bot added the triage Do not begin working on this issue until triaged by the team label Dec 20, 2024
@nguyenalex836 nguyenalex836 added actions This issue or pull request should be reviewed by the docs actions team waiting for review Issue/PR is waiting for a writer's review and removed triage Do not begin working on this issue until triaged by the team labels Dec 20, 2024
@nguyenalex836
Copy link
Contributor

@jsoref Thank you for raising this issue! I'll get this triaged for review ✨ Our team will provide feedback regarding the best next steps for this issue - thanks for your patience! 💛

@playb33

This comment was marked as spam.

@subatoi subatoi added the needs SME This proposal needs review from a subject matter expert label Jan 3, 2025
Copy link
Contributor

github-actions bot commented Jan 3, 2025

Thanks for opening an issue! We've triaged this issue for technical review by a subject matter expert 👀

@joshmgross
Copy link
Member

If you use uses: my-org/other-repo/.github/actions/shared-action@main then anyone who would trigger the workflow (as determined by on: ... conditions) especially in forks, but quite likely not limited to forks and doesn't have access to your my-org/other-repo repository will encounter an unfixable error of this form:

This would only apply to forks of private and internal repositories right?

If the upstream repository is public, it wouldn't be able to use private or internal reusable workflows in the first replace - regardless of how access is configured.

Additionally, the if statements would not prevent this error as all reusable workflows are resolved when a run is queued which is before job-level if statements are evaluated.

@nguyenalex836 nguyenalex836 added SME reviewed An SME has reviewed this issue/PR and removed waiting for review Issue/PR is waiting for a writer's review needs SME This proposal needs review from a subject matter expert labels Jan 16, 2025
@jsoref
Copy link
Contributor Author

jsoref commented Jan 17, 2025

It happens to me for this repository on a regular basis:
https://github.com/jsoref/github-docs/actions/runs/12816687823

I naively assumed that the workflow works for githubers otherwise, why would they ship it?

In retrospect, that was naïve. There are 11 pages of runs of this specific workflow failing 💯% of the time:
https://github.com/github/docs/actions/workflows/moda-ci.yaml

And apparently, someone at GitHub got tired of the ❌ and manually disabled it.

@joshmgross if you're on the GitHub actions team, then maybe you can take the specific workflow as input to provide a way for githubers and everyone else to avoid this situation. It didn't occur to me that there was no way for this to work.

My understanding is that this repository is actually synced to another disconnected fork that's either private or internal. There are other ways to manage a disconnected fork where things like this aren't carried over to the public repositories, and there would be ways for a syncing tool to add a commit to delete the file if one didn't want to do something else. But... a way for public repositories in this position to not cause problems for downstream forks would be good. And, again, advice to people who do things like this to think about forks in public repositories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actions This issue or pull request should be reviewed by the docs actions team content This issue or pull request belongs to the Docs Content team SME reviewed An SME has reviewed this issue/PR
Projects
None yet
Development

No branches or pull requests

5 participants