logo
0
1
WeChat Login

Introduction

Commit local code

Parameters

commitMessage

  • type: string
  • required: no
  • default value: chore: committed by ci

The Commit Message when committing

branchName

  • type: string
  • required: no
  • default value: commit-from-ci/firsteightcharactersofsha{first eight characters of sha}-{three random characters}

Temporary branch name

To prevent risks caused by arbitrary automated commits, a temporary branch will be created first, changes will be committed, and then pushed to origin, rather than committing directly on the corresponding branch.

Some projects may have restrictions on branch names, so you can specify the branch name here.

pushCurrent

  • type: boolean
  • required: no
  • default value: false

Whether to push to the current branch. If true, ignore branchName.

If in a push pipeline, it may cause pipeline infinite loops.

Choose carefully

addPatterns

  • type: string | string[]
  • required: no
  • default value: **

Specify directories and file lists for git add using glob patterns to match changed files obtained from git status --porcelain.

Note: If a new folder is added, such as dir1/dir2, regardless of how many files it contains, the changed file is dir1/dir2/. You can use dir1/dir2/** to match its folder or all files under the folder.

Exports

branch

If pushCurrent is not true, export branch as the newly created branch name.

Usage in Cloud Native Build

test: push: - stages: - name: set token imports: https://xxx.com/token.yml # Import TOKEN from private repository image: tencentcom/git-set-credential:latest settings: userName: ${USER_NAME} userEmail: ${USER_EMAIL} loginUserName: ${LOGIN_USER_NAME} loginPassword: ${LOGIN_PASSWORD} - name: update file script: echo test > test.txt - name: commit image: tencentcom/git-commit:latest settings: add: - test.txt commitMessage: "commit by ci" exports: branch: COMMIT_BRANCH - name: show branch script: echo $COMMIT_BRANCH

Usage with Docker

docker run --rm \ -e TZ=Asia/Shanghai \ -e PLUGIN_COMMITMESSAGE="test: committed by ci" \ -e PLUGIN_ADDPATTERNS="test.txt" \ -v $(pwd):$(pwd) \ -w $(pwd) \ tencentcom/git-commit:latest

About

git-commit

568.00 KiB
0 forks1 stars2 branches0 TagREADMEMIT license
Language
Markdown56%
JavaScript26.7%
Shell7.3%
License5.9%
Others4.1%