Replies: 1 comment
-
|
Thanks for the suggestion. This is not something I would add to the core of git-auto-commit as this is something too specific. However, you can create this behaviour on your own by extracting the previous git commit message and append your message. Here is an – untested – GitHub Actions workflow, that should help you in your projects. name: Formatting
on:
push
pull_request
jobs:
auto-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2 # Need at least 2 commits to get the previous one
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: npm install
- name: Run formatter
run: npm run format
- name: Extract previous commit message
id: prev_commit
run: |
# Get the previous commit message (before the current HEAD)
PREV_MSG=$(git log --format=%B -n 1 HEAD~1 | head -n 1)
echo "message=$PREV_MSG" >> $GITHUB_OUTPUT
echo "Previous commit message: $PREV_MSG"
- name: Auto-commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "${{ steps.prev_commit.outputs.message }} (+formatting)" |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
First of all, this is a great tool, my thanks for developing it.
I was wondering if it would be possible to add an option to add a modifier to the previous commit message rather than just put a new commit message.
For instance, the current behaviour is:
original commit: "added this and that"
auto-commit: "formatting"
but it could be:
original commit: "added this and that"
auto-commit: "added this and that (+formatting)"
This would make the latest commit messages less generic, which is usefull since these messages are directly visible.
Have a great day,
MrXerios
Beta Was this translation helpful? Give feedback.
All reactions