Commit local code
The Commit Message when committing
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.
Whether to push to the current branch. If true, ignore branchName.
If in a push pipeline, it may cause pipeline infinite loops.
Choose carefully
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.
If pushCurrent is not true, export branch as the newly created branch name.
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
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