|
| 1 | +name: Configlet Auto Sync |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + schedule: |
| 6 | + - cron: '0 0 1,15 * *' |
| 7 | + |
| 8 | +jobs: |
| 9 | + configlet-auto-sync: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Checkout repository |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Fetch configlet |
| 17 | + run: ./bin/fetch-configlet |
| 18 | + |
| 19 | + - name: Run configlet sync for files |
| 20 | + run: ./bin/configlet sync --docs --metadata --filepaths -u -y |
| 21 | + |
| 22 | + - name: Create pull request if changes |
| 23 | + uses: peter-evans/create-pull-request@v5 |
| 24 | + with: |
| 25 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 26 | + commit-message: "🤖 Auto-sync docs, metadata, and filepaths" |
| 27 | + title: "🤖 Configlet sync: docs, metadata, and filepaths" |
| 28 | + body-path: .github/auto-sync/PR_BODY.md |
| 29 | + branch: configlet-auto-sync |
| 30 | + delete-branch: true |
| 31 | + |
| 32 | + - name: Run configlet sync for test and capture output |
| 33 | + id: sync_test |
| 34 | + run: | |
| 35 | + ./bin/configlet sync --test | tee .github/auto-sync/sync-test-output.txt |
| 36 | + echo "output<<EOF" >> $GITHUB_OUTPUT |
| 37 | + cat .github/auto-sync/sync-test-output.txt >> $GITHUB_OUTPUT |
| 38 | + echo "EOF" >> $GITHUB_OUTPUT |
| 39 | +
|
| 40 | + - name: Create issue if tests are not synced |
| 41 | + if: ${{ !contains(steps.sync_test.outputs.output, 'Every exercise has up-to-date tests!') }} |
| 42 | + uses: peter-evans/create-issue-from-file@v4 |
| 43 | + with: |
| 44 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + title: "🚨 configlet sync --test found unsynced tests" |
| 46 | + content-filepath: .github/auto-sync/sync-test-output.txt |
0 commit comments