2nd Ai humanizer update #16
This file contains hidden or 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: Update Commit Hash | |
| on: | |
| push: | |
| branches: | |
| - main # Change if needed | |
| permissions: | |
| contents: write | |
| jobs: | |
| update-hash: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 1. Checkout repository | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: true | |
| # 2. Skip if last commit was made by GitHub Actions (to avoid loops) | |
| - name: Check last commit author | |
| id: check | |
| run: | | |
| LAST_AUTHOR=$(git log -1 --pretty=format:'%an') | |
| echo "last_author=$LAST_AUTHOR" >> $GITHUB_OUTPUT | |
| - name: Skip if commit was by GitHub Actions | |
| if: ${{ steps.check.outputs.last_author == 'github-actions' }} | |
| run: | | |
| echo "Last commit was by github-actions, skipping workflow." | |
| exit 0 | |
| # 3. Update public/commit.txt | |
| - name: Update commit.txt | |
| run: | | |
| mkdir -p public | |
| echo "$GITHUB_SHA" > public/commit.txt | |
| # 4. Configure Git | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "actions@github.com" | |
| # 5. Commit changes if any | |
| - name: Commit updated commit.txt | |
| run: | | |
| git add public/commit.txt | |
| git commit -m "Add Current Version Hash (Not an Update)" -m "This commit updates public/commit.txt to facilitate correct versioning and tracking of the deployed version." || echo "No changes to commit" | |
| # 6. Push back | |
| - name: Push changes | |
| run: git push |