diff --git a/.gitea/workflows/sync-upstream.yml b/.gitea/workflows/sync-upstream.yml new file mode 100644 index 0000000..c2fdf35 --- /dev/null +++ b/.gitea/workflows/sync-upstream.yml @@ -0,0 +1,62 @@ +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 Gitea + uses: actions/checkout@v4 + with: + fetch-depth: 0 + 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 "gitea-actions[bot]" + git config user.email "gitea-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