|
| 1 | +name: Update SpiceDB and Zed |
| 2 | +on: |
| 3 | + schedule: |
| 4 | + - cron: "0 * * * *" # every hour. |
| 5 | + workflow_dispatch: |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: write |
| 9 | + pull-requests: write |
| 10 | + issues: read |
| 11 | + checks: read |
| 12 | + actions: read |
| 13 | + statuses: read |
| 14 | + |
| 15 | +jobs: |
| 16 | + vendor: |
| 17 | + runs-on: depot-ubuntu-24.04-small |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v6 |
| 20 | + with: |
| 21 | + fetch-depth: "1" # only fetch the latest commit |
| 22 | + - name: vendor dependencies |
| 23 | + run: yarn run update:deps |
| 24 | + - name: check if any changes |
| 25 | + id: check-changes |
| 26 | + run: | |
| 27 | + if [[ -n "$(git status --porcelain .)" ]]; then |
| 28 | + echo "changes were vendored" |
| 29 | + git status |
| 30 | + echo "play_changed=true" >> $GITHUB_OUTPUT |
| 31 | + else |
| 32 | + echo "no changes were vendored" |
| 33 | + echo "play_changed=false" >> $GITHUB_OUTPUT |
| 34 | + fi |
| 35 | +
|
| 36 | + - name: If changes, make a PR |
| 37 | + if: steps.check-changes.outputs.play_changed == 'true' |
| 38 | + uses: "peter-evans/create-pull-request@v7" |
| 39 | + id: cpr |
| 40 | + with: |
| 41 | + token: ${{ secrets.AUTHZEDBOT_REPO_SCOPED_TOKEN }} |
| 42 | + commit-message: "vendor latest SpiceDB and Zed" |
| 43 | + title: "Auto-generated PR: Update SpiceDB and Zed to latest releases" |
| 44 | + body: "This PR was auto-generated by GitHub Actions." |
| 45 | + branch: "auto-update-branch" |
| 46 | + base: "main" |
| 47 | + |
| 48 | + - name: "Approve Pull Request" |
| 49 | + if: steps.check-changes.outputs.play_changed == 'true' |
| 50 | + uses: "juliangruber/approve-pull-request-action@b71c44ff142895ba07fad34389f1938a4e8ee7b0" # v2.0.6 |
| 51 | + with: |
| 52 | + repo: authzed/playground |
| 53 | + github-token: ${{ secrets.AUTHZEDAPPROVER_REPO_SCOPED_TOKEN }} |
| 54 | + number: ${{ steps.cpr.outputs.pull-request-number }} |
| 55 | + |
| 56 | + - name: "Enable Pull Request Automerge" |
| 57 | + if: steps.check-changes.outputs.play_changed == 'true' |
| 58 | + run: "gh pr merge ${{ steps.cpr.outputs.pull-request-number }} --merge --auto" |
| 59 | + env: |
| 60 | + GH_TOKEN: ${{ secrets.AUTHZEDAPPROVER_REPO_SCOPED_TOKEN }} |
| 61 | + |
| 62 | + - name: "Wait for all required checks to pass" |
| 63 | + if: steps.check-changes.outputs.play_changed == 'true' |
| 64 | + run: "gh pr checks --required --watch --interval 10 --fail-fast ${{ steps.cpr.outputs.pull-request-number }} " |
| 65 | + env: |
| 66 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 67 | + |
| 68 | + - name: "Notify in Slack if failure" |
| 69 | + if: ${{ failure() }} |
| 70 | + uses: "slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a" # v2.1.1 |
| 71 | + with: |
| 72 | + webhook: "${{ secrets.SLACK_BUILDS_WEBHOOK_URL }}" |
| 73 | + webhook-type: "incoming-webhook" |
| 74 | + payload: | |
| 75 | + text: "Broken vendoring of SpiceDB and Zed into Playground." |
| 76 | + blocks: |
| 77 | + - type: "section" |
| 78 | + text: |
| 79 | + type: "mrkdwn" |
| 80 | + text: | |
| 81 | + :x: A change in SpiceDB and/or Zed broke something in Playground. |
| 82 | + @eng-oss please take al ook. |
| 83 | + *PR:* <${{ github.server_url }}/${{ github.repository }}/pull/${{ steps.cpr.outputs.pull-request-number }}> |
0 commit comments