GH-200 · Question #32
GH-200 Question #32: Real Exam Question with Answer & Explanation
The correct answer is B: Create an organization secret, specify Selected repositories as the Repository access, and. Creating secrets for an organization When creating a secret or variable in an organization, you can use a policy to limit access by repository. For example, you can grant access to all repositories, or limit access to only private repositories or a specified list of repositories.
Question
A single secret must be accessed by workflows in specific repositories. What is the best way to create the secret?
Options
- ACreate an environment secret at the organization level and leverage that environment in each of
- BCreate an organization secret, specify Selected repositories as the Repository access, and
- CCreate the secret in one of the repositories, check the Share secret option, and select the
- DStore the secret in a supported external key vault. Configure OpenID Connect (OIDC) to allow
Explanation
Creating secrets for an organization When creating a secret or variable in an organization, you can use a policy to limit access by repository. For example, you can grant access to all repositories, or limit access to only private repositories or a specified list of repositories. To specify that the secret should be available to selected repositories within the organization, use the --repos or -r flag. gh secret set --org ORG_NAME SECRET_NAME --repos REPO-NAME-1, REPO-NAME-2 Note: REST API endpoints for GitHub Actions Secrets Use the REST API to interact with secrets in GitHub Actions. * Set selected repositories for an organization secret Replaces all repositories for an organization secret when the visibility for repository access is set to selected. The visibility is set when you Create or update an organization secret. Put /orgs/{org}/actions/secrets/{secret_name}/repositories https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/use- https://docs.github.com/en/rest/actions/secrets?apiVersion=2022-11-28#set-selected- repositories-for-an-organization-secret
Topics
Community Discussion
No community discussion yet for this question.