Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
play

GitHub Action

multi-file-commit

v0.2.0

multi-file-commit

play

multi-file-commit

Commit multiple files via the github API

Installation

Copy and paste the following snippet into your .yml file.

              

- name: multi-file-commit

uses: tyriis/[email protected]

Learn more about this action in tyriis/multi-file-commit

Choose a version

pre-commit taskfile

Multi File Commit

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

User Story

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).

The Idea

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.

Limitations

⚠️ the only limitation is that it can not be used on empty repositories.

What's new

  • First implementation is currently tested

Usage

- uses: tyriis/[email protected]
  with:
    # 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: ''

License

The scripts and documentation in this project are released under the MIT License