How to create github action secrets #9377
-
In the API doc, we can pass to https://www.pulumi.com/registry/packages/github/api-docs/actionssecret/ import pulumi
import pulumi_github as github
example_public_key = github.get_actions_public_key(repository="example_repository")
example_secret_actions_secret = github.ActionsSecret("exampleSecretActionsSecret",
repository="example_repository",
secret_name="example_secret_name",
plaintext_value=var["some_secret_string"])
example_secret_index_actions_secret_actions_secret = github.ActionsSecret("exampleSecretIndex/actionsSecretActionsSecret",
repository="example_repository",
secret_name="example_secret_name",
encrypted_value=var["some_encrypted_secret_string"]) I am using Python and I am wondering
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
To create the encrypted secret, you'll use the encryption method of your language of choice. I know it's supposed to be base64 encoded, so Python has the built-in base64 library for that part. It looks like GitHub recommends using LibSodium based on the information in their API docs. They've got an example putting those two libraries together to build the encoded secret in their docs. Regarding getting the key, I'd probably use the Let me know if this helped! |
Beta Was this translation helpful? Give feedback.
-
@tz-torchai @nimbinatus were you ever able to get this to work? I tried the solution in the selected answer, but it appeared that the |
Beta Was this translation helpful? Give feedback.
To create the encrypted secret, you'll use the encryption method of your language of choice. I know it's supposed to be base64 encoded, so Python has the built-in base64 library for that part. It looks like GitHub recommends using LibSodium based on the information in their API docs. They've got an example putting those two libraries together to build the encoded secret in their docs.
Regarding getting the key, I'd probably use the
getActionsPublicKey
call. I'm pretty sure there's other ways to do it, but I'd stay in Pulumi to get it.Let me know if this helped!