Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/jaid/commit-from-action
- Owner: Jaid
- License: mit
- Created: 2019-11-30T10:26:16.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2023-03-08T04:38:39.000Z (almost 2 years ago)
- Last Synced: 2024-08-08T23:46:44.679Z (6 months ago)
- Topics: action, actions, class, commit, fs, git, git-commit, github-action, github-actions, library, push, utility, vcs
- Language: JavaScript
- Homepage: https://github.com/Jaid/commit-from-action
- Size: 5.39 MB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: readme.md
- Funding: .github/funding.yml
- License: license.txt
Awesome Lists containing this project
README
# commit-from-action
**Utility class for making changes to a repository from a GitHub Action.**
## Installation
```bash
npm install --save commit-from-action@^2.0.6
``````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
InfoautoApprove
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)