commit-from-action
TypeScript icon, indicating that this package has built-in type declarations

2.0.6 • Public • Published

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

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

commit-from-action on Yarn

yarn add commit-from-action@^2.0.6

Example

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:

git clone git@github.com:jaid/commit-from-action.git
cd commit-from-action
npm install

License

MIT License
Copyright © 2021, Jaid <jaid.jsx@gmail.com> (https://github.com/jaid)

Package Sidebar

Install

npm i commit-from-action

Weekly Downloads

1

Version

2.0.6

License

none

Unpacked Size

27.7 kB

Total Files

6

Last publish

Collaborators

  • jaid