Skip to content

Daily WhatsApp Diff Update #245

Daily WhatsApp Diff Update

Daily WhatsApp Diff Update #245

Workflow file for this run

name: Daily WhatsApp Diff Update
"on":
schedule:
- cron: "0 6,18 * * *"
workflow_dispatch:
permissions:
contents: write
concurrency:
group: daily-wa-diff
cancel-in-progress: false
jobs:
update:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run daily fetch and export
run: npm run fetch
- name: Commit and push changes
id: commit
env:
BRANCH_NAME: ${{ github.ref_name }}
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
branch="${BRANCH_NAME}"
git add -A
if git diff --cached --quiet; then
echo "No changes to commit."
echo "pushed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
timestamp="$(date -u +'%Y-%m-%d %H:%M:%S UTC')"
git commit -m "chore: daily whatsapp bundles update (${timestamp})"
for attempt in 1 2 3; do
git fetch origin "${branch}"
git rebase "origin/${branch}"
if git push origin "HEAD:${branch}"; then
echo "Push succeeded on attempt ${attempt}."
echo "pushed=true" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "Push was rejected, retrying..."
done
echo "Failed to push after 3 attempts."
exit 1
- name: Setup Python
if: steps.commit.outputs.pushed == 'true'
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Generate AI summary
id: summary
if: steps.commit.outputs.pushed == 'true'
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: python .github/scripts/explain_commit.py
- name: Create release
if: steps.commit.outputs.pushed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ steps.summary.outputs.tag }}
TITLE: ${{ steps.summary.outputs.title }}
run: gh release create "$TAG" --title "$TITLE" --notes-file release_body.md --target "$GITHUB_SHA"