Skip to content

Make gh secret set selected repositories without re-defining the value #9383

Description

@yvele

Describe the feature or problem you’d like to solve

I need to manage my organization secrets and I want to update the selected repositories.

Kind of how it's done with the dedicated REST API:
https://docs.github.com/en/rest/actions/secrets?apiVersion=2022-11-28#set-selected-repositories-for-an-organization-secret (but with repository names instead of IDs)

At the moment when skipping --body

gh secret set MY_SECRET --org my-org --visibility selected --repos repo1,repo2

it read from reads from standard input:

? Paste your secret:

Proposed solution

How will it benefit CLI and its users?

We can add an extra tag that tells the CLI not to touch the previous secret value at all:

gh secret set MY_SECRET --org my-org --keep-previous-body --visibility selected --repos repo1,repo2

Not sure about the -keep-previous-body tag name.

But for sure I think it will be cumbersome to add an extra gh secret command for that.

Additional context

May be related to:

Activity

  1. andyfeller commented on Jul 29, 2024

    @andyfeller
    Contributor

    @yvele : I agree this is something I want to see improved around GitHub API and gh. This is touched on already within #8110, so I'm going to close this as a duplicate for now.

  2. added
    gh-secretrelating to the gh secret command
    and removed on Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIgh-secretrelating to the gh secret command

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions