Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/jaid/commit-from-action

Utility class for making changes to a repository from a GitHub Action.
https://github.com/jaid/commit-from-action

action actions class commit fs git git-commit github-action github-actions library push utility vcs

Last synced: about 1 month ago
JSON representation

Utility class for making changes to a repository from a GitHub Action.

Awesome Lists containing this project

README

        

# commit-from-action

License Sponsor commit-from-action
Build status Commits since v2.0.6 Last commit Issues
Latest version on npm Dependents Downloads

**Utility class for making changes to a repository from a GitHub Action.**

## Installation

commit-from-action on npm

```bash
npm install --save commit-from-action@^2.0.6
```

commit-from-action on Yarn

```bash
yarn add commit-from-action@^2.0.6
```

## Example

```javascript
import CommitManager from "commit-from-action"
import {writeFile} from "fs/promises"

await writeFile("abc.txt", "abc")

const commitManager = new CommitManager
try {
await commitManager.commit("Added file abc.txt")
await commitManager.push()
} catch (error) {
console.error(error)
} finally {
// Does some cleaning, should be called regardless of whether commit and push are successful or not.
await commitManager.finalize()
}
```

## Options

Type
Default
Info

autoApprove
boolean
true
If true, the created pull request will be automatically approved and merged.

autoRemoveBranch
boolean
true
If true, the created branch will be automatically deleted. Good for avoiding mess.

branch
string
randomly generated
Name of the temporary branch. If this is explicitly set, option `branchPrefix` is ignored.

branchPrefix
string
"action-"
Starting string of the temporary branch's name. The rest of it will be randomly generated.

commitMessage
string
"Modified repository in GitHub Action"
Default commit message to use, if commitManager.commit() is called without an argument.

githubTokenInputName
string
"githubToken"
The key of your action's input that passes the user's GitHub token.

ignoreFiles
string[]
[]
List of globs of files not to commit.

mergeMessage
string
"Automatically merged commits from pull {pullNumber}"
Commit message of the pull request's merge.

pullRequestBody
string
"Hewwo!"
Description of the automatically created pull request.

pullRequestTitle
string
"Automatic changes from GitHub Action"
Title of the automatically created pull request.

## Development

Development hints for maintaining and improving commit-from-action

Setting up:
```bash
git clone [email protected]:jaid/commit-from-action.git
cd commit-from-action
npm install
```

## License
[MIT License](https://raw.githubusercontent.com/jaid/commit-from-action/master/license.txt)
Copyright © 2021, Jaid \ (https://github.com/jaid)