Sync SRE from Gilfoyle #8610
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync SRE from Gilfoyle | |
| on: | |
| schedule: | |
| - cron: '*/15 * * * *' # Every 15 minutes | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout skills | |
| uses: actions/checkout@v4 | |
| - name: Checkout gilfoyle | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: axiomhq/gilfoyle | |
| path: _gilfoyle | |
| - name: Check for new commits | |
| id: check | |
| run: | | |
| GILFOYLE_SHA=$(git -C _gilfoyle rev-parse HEAD) | |
| LAST_SYNCED=$(git log -1 --format=%s -- skills/sre/ | grep -oP '(?<=gilfoyle@)[a-f0-9]+' || echo "") | |
| if [[ "${GILFOYLE_SHA:0:7}" == "$LAST_SYNCED" ]]; then | |
| echo "skip=true" >> $GITHUB_OUTPUT | |
| echo "Already synced to gilfoyle@${GILFOYLE_SHA:0:7}" | |
| else | |
| echo "skip=false" >> $GITHUB_OUTPUT | |
| echo "New commits: last synced $LAST_SYNCED, gilfoyle at ${GILFOYLE_SHA:0:7}" | |
| fi | |
| - name: Run sync | |
| if: steps.check.outputs.skip != 'true' | |
| run: _gilfoyle/scripts/sync-to-skills skills/sre | |
| - name: Run tests | |
| if: steps.check.outputs.skip != 'true' | |
| run: _gilfoyle/scripts/test-build skills/sre | |
| - name: Verify no extra files from repo root | |
| if: steps.check.outputs.skip != 'true' | |
| run: | | |
| # Ensure no .meta, site, or other non-skill files leaked | |
| for dir in .meta site .github; do | |
| if [[ -d "skills/sre/$dir" ]]; then | |
| echo "ERROR: $dir should not be in synced output" | |
| exit 1 | |
| fi | |
| done | |
| - name: Commit and push | |
| if: steps.check.outputs.skip != 'true' | |
| run: | | |
| GILFOYLE_SHA=$(git -C _gilfoyle rev-parse --short HEAD) | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add skills/sre/ | |
| git diff --cached --quiet && exit 0 | |
| git commit -m "sre: sync from gilfoyle@${GILFOYLE_SHA}" | |
| git push | |
| - name: Clean up | |
| if: always() | |
| run: rm -rf _gilfoyle |