Skip to content

Update OSS health snapshots #1

Update OSS health snapshots

Update OSS health snapshots #1

name: Update OSS health snapshots
on:
workflow_dispatch:
schedule:
- cron: '0 4 1 * *'
jobs:
update-oss-health:
runs-on: ubuntu-latest
steps:
- name: Checkout target repo
uses: actions/checkout@v4
with:
ref: 'main'
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Update OSS health data
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
make update-oss-health
git status -s
- name: Commit & push changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add data/oss-health static/oss-health-data content/en/oss-health
if git diff --cached --quiet; then
echo "No changes to commit"
exit 0
fi
git branch -D update-oss-health || true
git checkout -b update-oss-health
git commit --signoff -m "[oss-health] Update monthly OSS health snapshot $(date -u +'%Y-%m-%d %H:%M:%S')"
git push --force --set-upstream origin update-oss-health
- name: Open pull request if not exists
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pr_state=$(gh pr view update-oss-health --json state --jq .state 2>/dev/null || echo "")
echo "Current PR state: ${pr_state:-NONE}"
if [[ "$pr_state" == "OPEN" ]]; then
echo "An open pull request already exists – skipping creation."
else
gh pr create \
--title "[oss-health] Update monthly OSS health snapshot" \
--body "Automated update via workflow." \
--head update-oss-health \
--base main
fi