admin:org
scope to use this endpoint. GitHub Apps must have the secrets
organization permission to
from base64 import b64encode
from nacl import encoding, public
def encrypt(public_key: str, secret_value: str) -> str:
"""Encrypt a Unicode string using the public key."""
public_key = public.PublicKey(public_key.encode("utf-8"), encoding.Base64Encoder())
sealed_box = public.SealedBox(public_key)
encrypted = sealed_box.encrypt(secret_value.encode("utf-8"))
return b64encode(encrypted).decode("utf-8")
var secretValue = System.Text.Encoding.UTF8.GetBytes("mySecret");
var publicKey = Convert.FromBase64String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU=");
var sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey);
Console.WriteLine(Convert.ToBase64String(sealedPublicKeyBox));
curl --location --request PUT 'https://api.github.com/orgs//actions/secrets/' \
--header 'Content-Type: application/json' \
--data-raw '{
"encrypted_value": "c2VjcmV0",
"key_id": "012345678912345678",
"selected_repository_ids": [
"1296269",
"1296280"
],
"visibility": "selected"
}'
{}
Authorization: Bearer ********************
visibility
is set to selected
. You can manage the list of selected repositories using the List selected repositories for an organization secret, Set selected repositories for an organization secret, and Remove selected repository from an organization secret endpoints.all
- All repositories in an organization can access the secret.private
- Private repositories in an organization can access the secret.selected
- Only specific repositories can access the secret.【GitHub】API开发者 微信交流群
用微信扫右侧二维码,加入【GitHub】API开发者 交流群,互助沟通