chore: align badges and workflows with org template #34
Workflow file for this run
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 Last Modified Date | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| concurrency: | |
| group: pr-branch-maintenance-${{ github.event.pull_request.head.ref || github.ref_name }} | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| update-date: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout PR branch | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| - name: Fetch PR base branch | |
| run: git fetch --no-tags origin ${{ github.event.pull_request.base.ref }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Configure Git | |
| run: | | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --global user.name "github-actions[bot]" | |
| - name: Update last modified date in Markdown files | |
| env: | |
| PR_BASE_REF: ${{ github.event.pull_request.base.ref }} | |
| run: python .github/scripts/update_markdown_dates.py | |
| - name: Pull, commit, and push if needed | |
| env: | |
| TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| BRANCH="${{ github.event.pull_request.head.ref }}" | |
| git add -A | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| exit 0 | |
| fi | |
| git commit -m "Update last modified date in Markdown files" | |
| git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }} | |
| for attempt in 1 2 3; do | |
| git fetch origin "$BRANCH" | |
| git rebase "origin/$BRANCH" | |
| if git push origin HEAD:"$BRANCH"; then | |
| exit 0 | |
| fi | |
| done | |
| echo "Failed to push branch updates after 3 attempts." | |
| exit 1 |