-
Notifications
You must be signed in to change notification settings - Fork 959
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 skipping a job based on whether there is permission to access certain secrets #1138
Labels
Comments
thenewguy
added a commit
to thenewguy/ippsample
that referenced
this issue
Oct 10, 2021
bkeepers
added a commit
to flippercloud/flipper
that referenced
this issue
Nov 25, 2021
Thanks for the feedback @ismay, I've run into this problem myself. I'll put this on the backlog. |
ethomson
added
future
Feature work that we haven't prioritized
papercut
and removed
future
Feature work that we haven't prioritized
labels
Dec 17, 2021
Thanks! |
chabala
added a commit
to chabala/brick-control-lab
that referenced
this issue
Feb 11, 2023
* move Coveralls to conditional job based on secret availability ** also discovered Coveralls Github Action doesn't work with Java☹️ * add preconditional secret check job for Sonar * GitHub Actions conditional flow is a lot of work: github/docs#6861 actions/runner#520 actions/runner#953 actions/runner#1138
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the enhancement
Allow skipping a job based on whether there is permission to access a certain secret
Code Snippet
Currently, this is the most readable, concise way I've found of conditionally running jobs that need secrets (which checks exactly for the secrets that each job needs):
There are other ways of course, but my point is they all basically involve a lot of repetitive code. It is a very common usecase to check for the existence of a secret before running a job, as your workflows could potentially also be started by dependabot, or from a fork. But currently it is just way too cumbersome to do so. Plus it is polluting my action logs with a lot of near identical jobs that all check for secrets before a certain workflow runs (which is obscuring the info I really want to see).
My feature request is to allow for a more concise way to conditionally run a job depending on whether it has access to one or more secrets. So basically the functionality from the code sample above, but ideally just in the if condition of the job that needs the secrets (or potentially configured in another manner, as long as it cuts down on the above boilerplate).
Additional information
I'm not the only one who really wants this, see these issues and questions that all deal with this topic:
For a real-world example, see the workflows in this repo for example: https://github.com/ismay/superwolff/tree/55b76c6c4284021193c9dc920cde7a2de03c9522/.github/workflows. Which has 5 workflows, of which 4 have to implement almost the exact same boilerplate just to check whether secrets are available.
edit: seems slightly related to #662
edit 2: another approach that a lot of people use is using a condition like
github.repository_owner == '<USERNAME_HERE>' && github.actor != 'dependabot[bot]'
. This is a lot more concise than the example above and works well. However, it's a slightly indirect manner of checking for secrets. I still think the clearest solution here would be for github to expose a value that we can check against, to see whether secrets are available or not. That would allow checking for exactly what you're interested in, instead of having to check for the existence of secrets in a roundabout manner.The text was updated successfully, but these errors were encountered: