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

[Schema Inaccuracy] GitHub Actions Environment secrets can not be listed in the API if the repo environment name has a slash in it #3159

Closed
scott-doyland-burrows opened this issue Nov 6, 2023 · 3 comments

Comments

@scott-doyland-burrows
Copy link

Schema Inaccuracy

Repo environment secrets can not be listed in the API if the repo environment name has a slash in it.

Expected

I should be able to list all secrets in an environment no matter what the repo environment name is called.

Recreate the issue

Create a repo environment named a/b and then this will show no secrets:

curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer MY_TOKEN" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/repositories/<REPO_ID>/environments/a/b/secrets

The same issue occurs if getting an individual secret with:

curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer MY_TOKEN" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/repositories/<REPO_ID>/environments/a/b/secrets/<SECRET_NAME>

Documentation link:

https://docs.github.com/en/rest/actions/secrets?apiVersion=2022-11-28#list-environment-secrets

https://docs.github.com/en/rest/actions/secrets?apiVersion=2022-11-28#get-an-environment-secret

@shiftkey
Copy link
Member

shiftkey commented Nov 9, 2023

👋 Apologies for the delay @scott-doyland-burrows - I'm reaching out to the team for support as I think this is a bug but I'm not sure how this handles slashes.

@shiftkey
Copy link
Member

shiftkey commented Nov 9, 2023

@scott-doyland-burrows the environment names should be URL-encoded - replacing slashes with %2F values should do the trick.

Let me know if that unblocks you and I'll see if we can make this clearer in the docs.

@scott-doyland-burrows
Copy link
Author

Thanks for the info. That works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants