Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tyriis/multi-file-commit

GitHub Action to push more then one file via GitHub API with signed commits.
https://github.com/tyriis/multi-file-commit

action commit nodejs

Last synced: 4 days ago
JSON representation

GitHub Action to push more then one file via GitHub API with signed commits.

Awesome Lists containing this project

README

        

[![pre-commit][pre-commit-shield]][pre-commit-url]
[![taskfile][taskfile-shield]][taskfile-url]

# 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](#user-story)
- [The Idea](#the-idea)
- [Limitations](#limitations)
- [What's new](#whats-new)
- [Usage](#usage)
- [License](#license)

## 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:

Thanks for your work [Siddhartha Varma](https://github.com/BRO3886).

## Limitations

:warning: it cannot be used on empty repositories. \
:warning: parallel commits on the same file lead to a race condition where previous changes are overwritten.

## What's new

- First implementation is currently tested

## Usage

```yaml
- 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: ''

# In case you want to tag your commit, just pass a tag reference and this action will do the work for you.
tag: ''
```

## License

The scripts and documentation in this project are released under the [MIT License](LICENSE)

[pre-commit-shield]: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&style=for-the-badge
[pre-commit-url]: https://github.com/pre-commit/pre-commit
[taskfile-url]: https://taskfile.dev/
[taskfile-shield]: https://img.shields.io/badge/Taskfile-Enabled-brightgreen?logoColor=white&style=for-the-badge