Added README.md file for Sort Colors #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Remove '- LeetSync' from Commit Message | |
on: | |
push: | |
branches: | |
- main # Adjust to your branch name if different | |
jobs: | |
remove-leetsync: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Fetch full history to make amends | |
- name: Remove '- LeetSync' from commit message | |
run: | | |
# Get the latest commit message | |
commit_message=$(git log -1 --pretty=%B) | |
# Check if the commit message contains '- LeetSync' | |
if echo "$commit_message" | grep -q " - LeetSync"; then | |
# Remove '- LeetSync' from the commit message | |
new_commit_message=$(echo "$commit_message" | sed 's/ - LeetSync//g') | |
# Amend the commit message | |
git commit --amend -m "$new_commit_message" | |
# Force push the amended commit | |
git push origin main --force | |
else | |
echo "No '- LeetSync' in commit message, no changes made." | |
fi | |
env: | |
GIT_AUTHOR_NAME: Nitesh | |
GIT_AUTHOR_EMAIL: [email protected] | |
GIT_COMMITTER_NAME: Nitesh | |
GIT_COMMITTER_EMAIL: [email protected] |