Skip to content

Sync & Commit

Sync & Commit #544

name: Sync & Commit
on:
workflow_dispatch: {}
schedule:
# Runs at 00:00, 06:00, 12:00, 18:00 UTC daily (4× per day)
- cron: "0 0,6,12,18 * * *"
permissions:
contents: write # required for pushing to master
concurrency:
group: sync-and-commit
cancel-in-progress: false
env:
BUILD_CONFIGURATION: Release
ARTIFACT_DIR: artifacts
jobs:
run-sync-and-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: true
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
9.0.x
- name: Run sync-package-versions.ps1
shell: pwsh
run: |
if (-not (Test-Path "./sync-package-versions.ps1")) {
Write-Error "sync-package-versions.ps1 not found in repo root."
exit 1
}
./sync-package-versions.ps1
- name: Commit and push if there are changes
shell: bash
env:
GH_PAT: ${{ secrets.ACTIONS_PUSH_PAT }}
run: |
set -euo pipefail
git config user.name "agray"
git config user.email "agray@users.noreply.github.com"
export GIT_AUTHOR_NAME="agray"
export GIT_AUTHOR_EMAIL="agray@users.noreply.github.com"
export GIT_COMMITTER_NAME="agray"
export GIT_COMMITTER_EMAIL="agray@users.noreply.github.com"
git add -A
if git diff --cached --quiet; then
echo "✅ No changes detected after running sync-package-versions.ps1"
exit 0
fi
git commit -m "Automated version sync"
git pull --rebase origin master
echo "🔐 Using PAT to push changes..."
git push "https://x-access-token:${GH_PAT}@github.com/${{ github.repository }}" HEAD:master
echo "🚀 Changes committed and pushed to master via PAT."