Various scripts used for a variety of things
The generate-app-token.sh script generates GitHub App tokens for API authentication.
Usage:
./scripts/generate-app-token.sh
Outputs a GitHub App token and its expiration time.
The mirror-repository.sh script clones a source repository and mirrors it to a target repository using GitHub App authentication.
Usage:
./scripts/mirror-repository.sh
Mirrors the source repository to the target and optionally creates a pull request if configured.
-
Create environment file: Copy the example environment file and configure it with your GitHub App credentials:
cp .env.example .env
-
Configure
.env
file: Edit the.env
file with your actual values:APP_ID=your_actual_app_id CLIENT_ID=your_actual_client_id INSTALLATION_ID=your_actual_installation_id PEM_FILE=keys/your-private-key.pem TOKEN_API_DOMAIN=api.github.com SOURCE_REPO_URL=https://github.com/source-org/source-repo.git TARGET_ORG=your-target-org REPO_NAME=your-target-repo TARGET_DOMAIN=github.com # Optionally set CREATE_PR=true to create a PR instead of pushing directly # CREATE_PR=true
Required values:
APP_ID
: Your GitHub App's IDCLIENT_ID
: Your GitHub App's Client IDINSTALLATION_ID
: The installation ID for your GitHub AppPEM_FILE
: Path to your GitHub App's private key file (relative to project root)TOKEN_API_DOMAIN
: GitHub API domain (usuallyapi.github.com
)SOURCE_REPO_URL
: The HTTPS URL of the source repository to mirrorTARGET_ORG
: The target GitHub organizationREPO_NAME
: The name of the target repositoryTARGET_DOMAIN
: The GitHub domain (usuallygithub.com
)CREATE_PR
: (Optional) Set totrue
to create a pull request instead of pushing directly tomain
-
Place your private key: Put your GitHub App's private key file in the
keys/
directory