Skip to content

Run workflow only if secret is present #25444

Answered by BrightRan
Zethson asked this question in Actions
Discussion options

You must be logged in to vote

@zethson,

You can use the APIs “List repository secrets” and “List organization secrets” to get the total count of the repository-level secrets and organization-level secrets. Then according to the total count to determine whether to continue the subsequent jobs.

To run these two APIs, you need to create a personal access token (PAT) that has the repo scope (access repository-level secrets) and admin:org scope (access organization-level secrets), and set this PAT as a secret in the repository or in the organization. Then you can use this PAT to authenticate in the workflow.

Due to the added authorization PAT, there is an existing secret at least. If you want to ignore the PAT in the secre…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants