From b581dea4986aaa857e29532768d091db047f73a6 Mon Sep 17 00:00:00 2001 From: Gilbert Sanchez Date: Sat, 29 Aug 2026 02:21:24 +0000 Subject: [PATCH 1/2] Automate verified content updates --- .github/workflows/community-stats.yml | 11 +++++- .github/workflows/meetup-sync.yml | 11 +++++- .github/workflows/merge-automation-prs.yml | 44 ++++++++++++++++++++++ .github/workflows/podcast-sync.yml | 11 +++++- 4 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/merge-automation-prs.yml diff --git a/.github/workflows/community-stats.yml b/.github/workflows/community-stats.yml index 1a32fbdc7..b8506bb46 100644 --- a/.github/workflows/community-stats.yml +++ b/.github/workflows/community-stats.yml @@ -6,8 +6,7 @@ on: workflow_dispatch: permissions: - contents: write - pull-requests: write + contents: read jobs: update-community: @@ -27,9 +26,17 @@ jobs: - name: Fetch Discourse activity run: node .github/scripts/fetch-discourse-activity.js + - name: Create GitHub App token + id: app-token + uses: actions/create-github-app-token@v3 + with: + client-id: ${{ vars.AUTOMATION_APP_CLIENT_ID }} + private-key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }} + - name: Create pull request for updated community stats uses: peter-evans/create-pull-request@v8.1.1 with: + token: ${{ steps.app-token.outputs.token }} add-paths: data/community_stats.json branch: automation/update-community-stats commit-message: Update community stats diff --git a/.github/workflows/meetup-sync.yml b/.github/workflows/meetup-sync.yml index eb2139536..ef9ee232b 100644 --- a/.github/workflows/meetup-sync.yml +++ b/.github/workflows/meetup-sync.yml @@ -6,8 +6,7 @@ on: workflow_dispatch: permissions: - contents: write - pull-requests: write + contents: read concurrency: group: sync-meetup-events @@ -28,9 +27,17 @@ jobs: - name: Sync upcoming Meetup events run: node .github/scripts/sync-meetup-events.mjs + - name: Create GitHub App token + id: app-token + uses: actions/create-github-app-token@v3 + with: + client-id: ${{ vars.AUTOMATION_APP_CLIENT_ID }} + private-key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }} + - name: Create pull request for synchronized events uses: peter-evans/create-pull-request@v8.1.1 with: + token: ${{ steps.app-token.outputs.token }} add-paths: | content/calendar branch: automation/sync-meetup-events diff --git a/.github/workflows/merge-automation-prs.yml b/.github/workflows/merge-automation-prs.yml new file mode 100644 index 000000000..5964fa927 --- /dev/null +++ b/.github/workflows/merge-automation-prs.yml @@ -0,0 +1,44 @@ +name: Merge Verified Automation Pull Requests + +on: + workflow_run: + workflows: [Build Hugo Site] + types: [completed] + +permissions: + contents: read + +jobs: + merge: + if: >- + github.event.workflow_run.conclusion == 'success' && + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.head_repository.full_name == github.repository && + (github.event.workflow_run.head_branch == 'automation/update-community-stats' || + github.event.workflow_run.head_branch == 'automation/sync-meetup-events' || + github.event.workflow_run.head_branch == 'automation/sync-podcast') + runs-on: ubuntu-latest + steps: + - name: Create GitHub App token + id: app-token + uses: actions/create-github-app-token@v3 + with: + client-id: ${{ vars.AUTOMATION_APP_CLIENT_ID }} + private-key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }} + + - name: Merge the verified automation pull request + env: + APP_SLUG: ${{ steps.app-token.outputs.app-slug }} + GH_TOKEN: ${{ steps.app-token.outputs.token }} + HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }} + HEAD_SHA: ${{ github.event.workflow_run.head_sha }} + run: | + pull_request=$(gh pr view "$HEAD_BRANCH" --repo "$GITHUB_REPOSITORY" --json number,headRefOid,author,baseRefName,state) + test "$(jq -r '.author.login' <<<"$pull_request")" = "${APP_SLUG}[bot]" + test "$(jq -r '.baseRefName' <<<"$pull_request")" = main + test "$(jq -r '.state' <<<"$pull_request")" = OPEN + gh pr merge "$(jq -r '.number' <<<"$pull_request")" \ + --repo "$GITHUB_REPOSITORY" \ + --squash \ + --delete-branch \ + --match-head-commit "$HEAD_SHA" diff --git a/.github/workflows/podcast-sync.yml b/.github/workflows/podcast-sync.yml index 6ab8b73e3..f219cb04a 100644 --- a/.github/workflows/podcast-sync.yml +++ b/.github/workflows/podcast-sync.yml @@ -9,8 +9,7 @@ on: # episode could roll off the feed. See docs/adr/0003-incremental-podcast-sync.md. permissions: - contents: write - pull-requests: write + contents: read jobs: sync-podcast: @@ -30,9 +29,17 @@ jobs: - name: Sync podcast feed run: node .github/scripts/sync-podcast-feed.js + - name: Create GitHub App token + id: app-token + uses: actions/create-github-app-token@v3 + with: + client-id: ${{ vars.AUTOMATION_APP_CLIENT_ID }} + private-key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }} + - name: Create pull request for new episodes uses: peter-evans/create-pull-request@v8.1.1 with: + token: ${{ steps.app-token.outputs.token }} add-paths: | content/podcast branch: automation/sync-podcast From 111a5f48014cf34082da9bbae0de54935a50c523 Mon Sep 17 00:00:00 2001 From: Gilbert Sanchez Date: Fri, 28 Aug 2026 19:26:00 -0700 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/merge-automation-prs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/merge-automation-prs.yml b/.github/workflows/merge-automation-prs.yml index 5964fa927..436e8cb80 100644 --- a/.github/workflows/merge-automation-prs.yml +++ b/.github/workflows/merge-automation-prs.yml @@ -37,6 +37,7 @@ jobs: test "$(jq -r '.author.login' <<<"$pull_request")" = "${APP_SLUG}[bot]" test "$(jq -r '.baseRefName' <<<"$pull_request")" = main test "$(jq -r '.state' <<<"$pull_request")" = OPEN + test "$(jq -r '.headRefOid' <<<"$pull_request")" = "$HEAD_SHA" gh pr merge "$(jq -r '.number' <<<"$pull_request")" \ --repo "$GITHUB_REPOSITORY" \ --squash \