Skip to content

GitHub Commit: Create signed commits via GitHub's API

License

Notifications You must be signed in to change notification settings

gemini-oss/ghommit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ghommit

GitHub Commit: Create signed commits via GitHub's API

Example usage

# 1. Set the staging area

git checkout -b ghommit-testing
echo foo >> foo
git add foo

# 2. Set the environment variables

export GHOMMIT_GITHUB_APP_ID='Fill this in'
export GHOMMIT_GITHUB_APP_INSTALLATION_ID='Fill this in'
export GHOMMIT_GITHUB_APP_PRIVATE_KEY_PEM_DATA='Fill this in'

# 3. Run ghommit to have the GitHub App create the commit
#    - Note that this is like `commit` and `push` in one command with the caveat
#      that the local git state will not be in sync since the commit is being
#      done remotely

ghommit -m 'Adding to foo'

# 4. (optional) If more git-related actions needs to be performed, keep in mind
#    that that git state is out of sync and may require syncing

Building

# One-time setup for cross-compilation
cargo install cross

# Building for the current machine
cargo build --release

# Building for Linux (x86_64)
cross build --release --target=x86_64-unknown-linux-musl

Testing

  • Note: Many of the integration tests are ignored by default because they require many environment variables to be set:
    • Normal environment variables:
      • GHOMMIT_GITHUB_APP_ID
      • GHOMMIT_GITHUB_APP_INSTALLATION_ID
      • GHOMMIT_GITHUB_APP_PRIVATE_KEY_PEM_DATA
    • Test environment variables
      • GHOMMIT_TEST_BASE_TREE_ID
      • GHOMMIT_TEST_COMMIT_MESSAGE
      • GHOMMIT_TEST_GITHUB_REPO_OWNER
      • GHOMMIT_TEST_GITHUB_REPO_NAME
      • GHOMMIT_TEST_REPO_PATH
# - Run the unit tests

cargo test --lib

# - Run the integration tests

cargo test --test '*'

# - Run all unignored tests

cargo test

# - Run the ignored tests

cargo test -- --ignored

# - Run all tests

cargo test
cargo test -- --ignored