mirror of
https://github.com/stefanzweifel/git-auto-commit-action.git
synced 2025-08-01 07:56:08 +08:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8040434425 | ||
|
fc174e2406 | ||
|
8c3ed373fb | ||
|
797544dbd2 | ||
|
0d6c97e470 | ||
|
f6048aa2ac | ||
|
983386a337 | ||
|
b8ff4cd716 |
45
.github/release-drafter.yml
vendored
Normal file
45
.github/release-drafter.yml
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
ame-template: 'v$RESOLVED_VERSION'
|
||||
tag-template: 'v$RESOLVED_VERSION'
|
||||
template: |
|
||||
# What's Changed
|
||||
$CHANGES
|
||||
categories:
|
||||
- title: Added
|
||||
labels:
|
||||
- 'changelog:added'
|
||||
- title: Changed
|
||||
labels:
|
||||
- 'changelog:changed'
|
||||
- title: Deprecated
|
||||
labels:
|
||||
- 'changelog:deprecated '
|
||||
- title: Removed
|
||||
labels:
|
||||
- 'changelog:removed'
|
||||
- title: Fixed
|
||||
labels:
|
||||
- 'changelog:fixed'
|
||||
- title: Security
|
||||
labels:
|
||||
- security
|
||||
- changelog:security
|
||||
- title: 'Dependency Updates'
|
||||
labels:
|
||||
- dependencies
|
||||
|
||||
version-resolver:
|
||||
major:
|
||||
labels:
|
||||
- 'changelog:removed'
|
||||
minor:
|
||||
labels:
|
||||
- 'changelog:added'
|
||||
- 'changelog:deprecated'
|
||||
patch:
|
||||
labels:
|
||||
- 'changelog:fixed'
|
||||
- 'changelog:security'
|
||||
- 'dependency'
|
||||
|
||||
exclude-labels:
|
||||
- 'skip-changelog'
|
14
.github/workflows/release-drafter.yml
vendored
Normal file
14
.github/workflows/release-drafter.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
name: Release Drafter
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
update_release_draft:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: release-drafter/release-drafter@v5
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
28
.github/workflows/update-changelog.yaml
vendored
Normal file
28
.github/workflows/update-changelog.yaml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
name: "Update Changelog"
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
|
||||
jobs:
|
||||
update:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: master
|
||||
|
||||
- name: Update Changelog
|
||||
uses: stefanzweifel/changelog-updater-action@v1
|
||||
with:
|
||||
release-notes: ${{ github.event.release.body }}
|
||||
latest-version: ${{ github.event.release.name }}
|
||||
|
||||
- name: Commit updated CHANGELOG
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
branch: master
|
||||
commit_message: Update CHANGELOG
|
||||
file_pattern: CHANGELOG.md
|
@@ -20,6 +20,9 @@ Add the following step at the end of your job, after other steps that might add
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||
```
|
||||
|
||||
Note that the Action has to be used in a Job that runs on a UNIX system (eg. `ubuntu-latest`).
|
||||
If you don't use the default permission of the GITHUB_TOKEN, give the Job or Workflow at least the `contents: write` permission.
|
||||
|
||||
The following is an extended example with all possible options available for this Action.
|
||||
|
||||
```yaml
|
||||
@@ -75,6 +78,9 @@ The following is an extended example with all possible options available for thi
|
||||
# Optional. Skip internal call to `git fetch`
|
||||
skip_fetch: true
|
||||
|
||||
# Optional. Skip internal call to `git checkout`
|
||||
skip_checkout: true
|
||||
|
||||
# Optional. Prevents the shell from expanding filenames.
|
||||
# Details: https://www.gnu.org/software/bash/manual/html_node/Filename-Expansion.html
|
||||
disable_globbing: true
|
||||
|
@@ -60,6 +60,10 @@ inputs:
|
||||
description: Skip the call to git-fetch.
|
||||
required: false
|
||||
default: false
|
||||
skip_checkout:
|
||||
description: Skip the call to git-checkout.
|
||||
required: false
|
||||
default: false
|
||||
disable_globbing:
|
||||
description: Stop the shell from expanding filenames (https://www.gnu.org/software/bash/manual/html_node/Filename-Expansion.html)
|
||||
default: false
|
||||
|
@@ -55,9 +55,13 @@ _switch_to_branch() {
|
||||
git fetch --depth=1;
|
||||
fi
|
||||
|
||||
# Switch to branch from current Workflow run
|
||||
# shellcheck disable=SC2086
|
||||
git checkout $INPUT_BRANCH;
|
||||
if "$INPUT_SKIP_CHECKOUT"; then
|
||||
echo "::debug::git-checkout has not been executed";
|
||||
else
|
||||
# Switch to branch from current Workflow run
|
||||
# shellcheck disable=SC2086
|
||||
git checkout $INPUT_BRANCH;
|
||||
fi
|
||||
}
|
||||
|
||||
_add_files() {
|
||||
|
@@ -24,6 +24,7 @@ setup() {
|
||||
export INPUT_PUSH_OPTIONS=""
|
||||
export INPUT_SKIP_DIRTY_CHECK=false
|
||||
export INPUT_SKIP_FETCH=false
|
||||
export INPUT_SKIP_CHECKOUT=false
|
||||
export INPUT_DISABLE_GLOBBING=false
|
||||
|
||||
# Configure Git
|
||||
@@ -381,6 +382,19 @@ git_auto_commit() {
|
||||
assert_line "::debug::git-fetch has not been executed"
|
||||
}
|
||||
|
||||
@test "If SKIP_CHECKOUT is true git-checkout will not be called" {
|
||||
|
||||
touch "${FAKE_LOCAL_REPOSITORY}"/new-file-{1,2,3}.txt
|
||||
|
||||
INPUT_SKIP_CHECKOUT=true
|
||||
|
||||
run git_auto_commit
|
||||
|
||||
assert_success
|
||||
|
||||
assert_line "::debug::git-checkout has not been executed"
|
||||
}
|
||||
|
||||
@test "It pushes generated commit and tag to remote and actually updates the commit shas" {
|
||||
INPUT_BRANCH=""
|
||||
INPUT_TAGGING_MESSAGE="v2.0.0"
|
||||
@@ -477,3 +491,19 @@ git_auto_commit() {
|
||||
run git status
|
||||
refute_output --partial 'nested/new-file-b.py'
|
||||
}
|
||||
|
||||
@test "it does not throw an error if not changes are detected and SKIP_DIRTY_CHECK is false" {
|
||||
INPUT_FILE_PATTERN="."
|
||||
INPUT_SKIP_DIRTY_CHECK=false
|
||||
INPUT_SKIP_FETCH=false
|
||||
|
||||
run git_auto_commit
|
||||
|
||||
assert_success
|
||||
|
||||
assert_line "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}"
|
||||
assert_line "::set-output name=changes_detected::false"
|
||||
|
||||
run git status
|
||||
assert_output --partial 'nothing to commit, working tree clean'
|
||||
}
|
||||
|
Reference in New Issue
Block a user