Add Forgejo Actions workflow for automatic upstream sync
Runs weekly (Sunday 06:00 UTC) or on manual trigger. Uses GITEA_TOKEN auto-provided by Forgejo Actions to push back.
This commit is contained in:
parent
3b425b6fc8
commit
48320cb21e
|
|
@ -0,0 +1,63 @@
|
|||
name: Sync Upstream Skills
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Weekly: Sunday 06:00 UTC
|
||||
- cron: '0 6 * * 0'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout from Forgejo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
# Forgejo Actions auto-provides GITEA_TOKEN for the current repo
|
||||
token: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
- name: Add upstream remote
|
||||
run: |
|
||||
git remote add upstream https://github.com/obra/superpowers.git
|
||||
git fetch upstream --depth=1
|
||||
|
||||
- name: Sync selected skills
|
||||
id: sync
|
||||
run: |
|
||||
SKILLS="
|
||||
systematic-debugging
|
||||
test-driven-development
|
||||
verification-before-completion
|
||||
writing-plans
|
||||
requesting-code-review
|
||||
receiving-code-review
|
||||
finishing-a-development-branch
|
||||
"
|
||||
|
||||
CHANGED=false
|
||||
for skill in $SKILLS; do
|
||||
diff_files=$(git diff --name-only HEAD upstream/main -- "skills/$skill" 2>/dev/null || true)
|
||||
if [ -n "$diff_files" ]; then
|
||||
echo "Updating skills/$skill..."
|
||||
git checkout upstream/main -- "skills/$skill"
|
||||
git add "skills/$skill"
|
||||
CHANGED=true
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$CHANGED" = true ]; then
|
||||
echo "changed=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "changed=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Commit and push
|
||||
if: steps.sync.outputs.changed == 'true'
|
||||
run: |
|
||||
git config user.name "forgejo-actions[bot]"
|
||||
git config user.email "forgejo-actions@git.vpsj.de"
|
||||
|
||||
UPSTREAM_SHA=$(git rev-parse --short upstream/main)
|
||||
git commit -m "Sync skills from obra/superpowers upstream (${UPSTREAM_SHA})"
|
||||
git push origin main
|
||||
Loading…
Reference in New Issue