Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/update-updates-json.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Update updates.json commit

"on":
push:
branches:
- main

permissions:
contents: write

jobs:
update-commit:
if: github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Update commit field in updates.json
env:
LATEST_COMMIT: ${{ github.sha }}
run: |
python3 - <<'PY'
import json
import os

path = "updates.json"
with open(path, "r", encoding="utf-8") as f:
data = json.load(f)

data["commit"] = os.environ["LATEST_COMMIT"]

with open(path, "w", encoding="utf-8") as f:
json.dump(data, f, indent=2)
f.write("\n")
PY

- name: Commit and push changes
env:
LATEST_COMMIT: ${{ github.sha }}
run: |
if git diff --quiet -- updates.json; then
echo "No changes to commit"
exit 0
fi

git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add updates.json
git commit -m "chore: update updates.json commit to ${LATEST_COMMIT}"
git push