Update delete-license-key.yml #3
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: Delete File and Commit Changes | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
delete-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Delete File and Commit Changes | |
run: | | |
rm -f app/config/license.key # Use '-f' flag to suppress error if the file doesn't exist | |
if git status --porcelain | grep 'app/config/license.key'; then | |
git add . | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git commit -m "Delete license.key file" | |
else | |
echo "Nothing to commit. File does not exist." | |
fi | |
- name: Push Changes | |
if: ${{ !contains(github.event.head_commit.message, 'Delete license.key file') }} # Skip push if no changes were committed | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |