Skip to content

Initial release: Commit Action v0.1.0#1

Merged
c-vigo merged 5 commits intomainfrom
dev
Dec 18, 2025
Merged

Initial release: Commit Action v0.1.0#1
c-vigo merged 5 commits intomainfrom
dev

Conversation

@c-vigo
Copy link
Contributor

@c-vigo c-vigo commented Dec 17, 2025

Description

This PR introduces the initial implementation of Commit Action - a modular GitHub Action that creates signed commits via the GitHub API, allowing commits to bypass repository rulesets and branch protection rules.

The action provides a TypeScript-based solution for programmatically committing changes through GitHub's API rather than traditional git push, which enables automatic commit signing by GitHub and circumvents restrictions that would otherwise block direct pushes.

Related Issue(s)

None

Type of Change

  • New feature (non-breaking change which adds functionality)

Changes Made

Core Implementation (src/commit.ts):

  • Implemented commitViaAPI() main function with modular architecture
  • Created helper functions: createBlob(), createTree(), createCommit(), updateBranch(), getBranchInfo()
  • Added TypeScript interfaces: CommitOptions and CommitResult
  • Implemented file permission detection (executable vs regular files)
  • Added base64 encoding for binary-safe file content transfer

CLI Runner (src/commit-runner.ts):

  • Built CLI tool for standalone execution via npm run commit
  • Environment variable configuration support (GITHUB_TOKEN, GITHUB_REPOSITORY, GITHUB_REF, etc.)
  • Automatic directory expansion to individual files
  • Git status auto-detection when FILE_PATHS is not provided
  • Output variables for GitHub Actions integration

GitHub Action (action.yml):

  • Action metadata configuration for marketplace
  • Node 20 runtime specification
  • Bundled distribution setup

Testing & Infrastructure:

  • Jest test suite with unit tests (src/__tests__/unit/commit.test.ts)
  • TypeScript configuration (tsconfig.json, tsconfig.test.json)
  • Build and bundle scripts using ncc
  • ESLint and Prettier configuration

Testing

  • Unit tests pass locally (npm test)
  • TypeScript compilation successful (npm run build)
  • Bundle generation successful (npm run bundle)
  • Linting passes (npm run lint)
  • Manual testing performed (describe below)

Manual Testing Details

Unit Tests:

  • All unit tests in src/__tests__/unit/commit.test.ts pass
  • Test coverage for core functions: commitViaAPI, createBlob, createTree, createCommit, updateBranch, getBranchInfo
  • Mock implementations for GitHub API calls

Manual CLI Testing:

  1. Set up test repository with GITHUB_TOKEN
  2. Modified test files and ran npm run commit
  3. Verified commit created via GitHub API with automatic signing
  4. Tested directory expansion (FILE_PATHS with directory paths)
  5. Tested auto-detection with git status (no FILE_PATHS set)
  6. Confirmed files committed successfully and branch updated

Action Bundle Testing:

  • Generated bundle with npm run bundle
  • Verified dist/index.js created successfully
  • Checked bundle size and dependencies included

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (README.md, CONTRIBUTE.md, etc.)
  • I have updated the CHANGELOG.md in the [Unreleased] section
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

Project Structure:

commit_action/
├── src/
│   ├── commit.ts              # Core commit logic
│   ├── commit-runner.ts       # CLI runner
│   └── __tests__/
│       └── unit/
│           └── commit.test.ts # Unit tests
├── dist/                      # Bundled output for Actions
├── action.yml                 # GitHub Action metadata
├── package.json               # Dependencies and scripts
├── tsconfig.json              # TypeScript config
├── jest.config.js             # Jest test config
└── README.md                  # Documentation

Key Features:

  1. API-based commits - Uses GitHub API instead of git push
  2. Automatic signing - All commits are signed by GitHub
  3. Ruleset bypass - Works around branch protection and rulesets
  4. Modular design - Can be used as action, CLI, or imported module
  5. Type-safe - Full TypeScript implementation with interfaces
  6. Flexible input - Supports files, directories, or auto-detection

Use Cases:

  • Automated commits in CI/CD pipelines
  • Bypassing branch protection for bot commits
  • Creating signed commits without GPG setup
  • Committing generated files (docs, reports, etc.)

Install Node.js, npm, act, and local-action for development environment setup
- Implemented a modular GitHub Action for committing changes via the GitHub API, allowing for automatically signed commits that bypass repository rulesets.
- Added TypeScript configuration and ESLint setup for code quality.
- Included Jest for unit testing with comprehensive test coverage.
- Updated .gitignore and .npmignore to manage ignored files effectively.
- Created README documentation for usage instructions and API details.
- Enhanced pre-commit hooks for linting and formatting.
@c-vigo c-vigo self-assigned this Dec 17, 2025
@c-vigo c-vigo requested a review from gerchowl December 17, 2025 18:14
- Added new extensions to enhance development experience: GitHub Actions, ESLint, and Prettier.
- Configured TypeScript settings for improved code quality and auto-import suggestions.
- Updated search exclusions to prevent indexing of unnecessary files and directories.
@c-vigo c-vigo changed the title feat: Initial implementation of Commit Action Initial release of Commit Action Dec 17, 2025
@c-vigo c-vigo changed the title Initial release of Commit Action Initial release: Commit Action v0.1.0 Dec 17, 2025
@c-vigo c-vigo removed the request for review from gerchowl December 18, 2025 14:56
@c-vigo c-vigo merged commit 9d06bac into main Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant