This action commit multiple files over the GitHub API by pushing blobs and adding them to a tree. It commit all staged files.
Table of Contents
As a user I want to push and commit multiple files in 1 commit. if doing it via git push, there is no way to sign the the commit in an action context.
Of course I want to use only signed commits restriction on my branches (and I dont want to bypass the restriction to protect my software supply chain).
It is possible to create blobs and tree to create a commit via GitHub API. I found the solution to the problem here: https://siddharthav.medium.com/push-multiple-files-under-a-single-commit-through-github-api-f1a5b0b283ae
Thanks for your work Siddhartha Varma.
- First implementation is currently tested
- Runtime upgraded to Node 24 (GitHub Action runtime and package engine)
zxupgraded to latest major (8.x)
- uses: tyriis/multi-file-commit@v1.0.0with:
# Repository name with owner. For example, actions/checkout# Default: ${{ github.repository }}repository: ''# The branch you want to push the commit# Default: ${{ github.ref_name }}ref: ''# Personal access token (PAT) used to fetch the repository. The PAT is configured# with the local git config, which enables your scripts to run GitHub API commands.# Default: ${{ github.token }}token: ''# The commit message for the commit.message: ''# A list of files to commit, prevent other staged files to be commited.# Example: src/main.mjs,src/main.spec.js# If not set all staged files are considered for commit.files: ''# In case you want to tag your commit, just pass a tag reference and this action will do the work for you.tag: ''The scripts and documentation in this project are released under the MIT License