Skip to main content

GitHub Secret Updater

Background

Managing secrets in GitHub repositories is crucial for maintaining security in CI/CD pipelines. This script automates the process of updating secrets in GitHub repositories using GitHub API.

What is the Script/Package

This script allows you to update GitHub secrets either by specifying individual secret names and values or by reading from an environment file (.env). It fetches the public key for the repository, encrypts the secret using the public key, and then updates the secret in the repository.

Usage

Installation

  1. Install the required Python packages:

    pip install secret-updater
    
  2. Save the script to a file, for example, update_github_secrets.py.

Command Line Arguments

  • --secret: Name of the secret to update
  • --value: Value of the secret to update
  • --repo: Name of the repository (in the format owner/repo)
  • --token: GitHub token (can also be set as an environment variable GH_TOKEN)
  • --env-file: Path to the environment file containing secrets (recommended filename: .env)

Examples

Update a Single Secret

To update a single secret:

secret-updater --secret SECRET_NAME --value SECRET_VALUE --repo owner/repo --token YOUR_GITHUB_TOKEN

To update a set of secrets from an environment file:

secret-updater --env-file .env --repo owner/repo --token YOUR_GITHUB_TOKEN

The env file should contain the secrets in the formats

SECRET_NAME=SECRET_VALUE

or

export SECRET_NAME="SECRET_VALUE"

Metadata

Release files for secret-updater 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for secret-updater 0.1.2
File Size Uploaded Provenance Actions
secret_updater-0.1.2.tar.gz 3.7 kB Without provenance Details for secret_updater-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for secret-updater 0.1.2
File Interpreter ABI Platform Actions
secret_updater-0.1.2-py3-none-any.whl Python 3 none any Details for secret_updater-0.1.2-py3-none-any.whl

Total release size: 9.1 kB

Release files / secret_updater-0.1.2.tar.gz

Download URL secret_updater-0.1.2.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
245c5d7c73d0b7e9fb184a611447ffe6d6188ab2b60a815f352939cf7f0c4589
BLAKE2b-256 checksum
How to use checksums
88402c2cfc3305f7600dcfd7dcc0c9ee8f3d2becdd095fc81a6217ec0d4e7ab4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3

Release files / secret_updater-0.1.2-py3-none-any.whl

Download URL secret_updater-0.1.2-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e184bd19615405ef84ac87c53c3d9b02fbfc80af9ec47d88a5966d8e4c185b5
BLAKE2b-256 checksum
How to use checksums
812836e247d710ee02112f9f0fb5f1a5335d014f8b49141bf6097350f9218b49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3

Security for secret-updater 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page