Skip to content

Time: 0 ms (100.00%) | Memory: 9 MB (57.19%) - LeetSync #50

Time: 0 ms (100.00%) | Memory: 9 MB (57.19%) - LeetSync

Time: 0 ms (100.00%) | Memory: 9 MB (57.19%) - LeetSync #50

Workflow file for this run

name: Clean Commit Message
on:
push:
branches:
- main # Adjust to your branch name if different
jobs:
clean-commit-message:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch full history to make amends
- name: Amend commit message to remove '- LeetSync'
run: |
# Get the latest commit message
$commitMessage = git log -1 --pretty=%B
# Check if the commit message contains '- LeetSync'
if ($commitMessage -match " - LeetSync") {
# Remove '- LeetSync' from the commit message
$newCommitMessage = $commitMessage -replace " - LeetSync", ""
# Amend the commit message
git commit --amend -m $newCommitMessage
# Force push the amended commit
git push origin main --force
} else {
Write-Output "No ' - LeetSync' in commit message, no changes made."
}
env:
GIT_AUTHOR_NAME: GitHub Actions
GIT_AUTHOR_EMAIL: actions@github.com
GIT_COMMITTER_NAME: GitHub Actions
GIT_COMMITTER_EMAIL: actions@github.com