From b6fe6c7ca30c2f216583c78fd1e16e39a98e9796 Mon Sep 17 00:00:00 2001 From: Qisthi Ramadhani Date: Mon, 23 Nov 2026 21:33:26 +0700 Subject: [PATCH] ci: update-laravel starts the PR checks itself A PR pushed with GITHUB_TOKEN does not trigger pull_request workflows, so the weekly Laravel PR sat without checks until someone closed and reopened it. After opening or updating the PR, the workflow now dispatches the check workflows on deps/laravel-auto (they gain a workflow_dispatch trigger); their results show on the PR's head commit. Skipped when DEPS_PAT is set. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/docker.yml | 3 +++ .github/workflows/tests.yml | 3 +++ .github/workflows/update-laravel.yml | 23 ++++++++++++++++++++--- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f5bfe71..8d14c62 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -7,6 +7,9 @@ on: pull_request: branches: - main + # Run by update-laravel on its PR branch (a PR pushed with GITHUB_TOKEN + # does not trigger pull_request workflows). + workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 232f223..2963bc7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,6 +7,9 @@ on: pull_request: branches: - main + # Run by update-laravel on its PR branch (a PR pushed with GITHUB_TOKEN + # does not trigger pull_request workflows). + workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/update-laravel.yml b/.github/workflows/update-laravel.yml index d8cddd8..52f8f36 100644 --- a/.github/workflows/update-laravel.yml +++ b/.github/workflows/update-laravel.yml @@ -21,16 +21,18 @@ on: permissions: contents: write pull-requests: write + actions: write # dispatch the PR checks below jobs: update: runs-on: ubuntu-latest timeout-minutes: 20 + env: + HAS_DEPS_PAT: ${{ secrets.DEPS_PAT != '' }} steps: # token: PAT opsional (secret DEPS_PAT). Dengan GITHUB_TOKEN bawaan, - # push branch PR tidak memicu workflow tests (anti-loop GitHub) sehingga - # PR deps tampil tanpa checks; set DEPS_PAT (repo scope) untuk - # menghilangkan keharusan close/reopen PR tiap minggu. + # push branch PR tidak memicu workflow tests (anti-loop GitHub); langkah + # terakhir menjalankan checks lewat workflow_dispatch sebagai gantinya. # Do not leave a write token in .git/config while composer and bunx run # freshly resolved third-party code; create-pull-request gets its own # token input below. @@ -58,6 +60,7 @@ jobs: echo "LARAVEL=$(composer show laravel/framework --no-interaction | awk '/^versions/ {print $NF}')" >> "$GITHUB_ENV" - name: Open PR + id: cpr uses: peter-evans/create-pull-request@v8 with: token: ${{ secrets.DEPS_PAT || github.token }} @@ -72,3 +75,17 @@ jobs: composer.json composer.lock delete-branch: true + + # A PR pushed with GITHUB_TOKEN does not start pull_request workflows, so + # start the checks on the PR branch; their results show on the PR's head + # commit. Skipped when DEPS_PAT is set, because then the push starts them. + - name: Run the PR checks + if: >- + env.HAS_DEPS_PAT != 'true' && + (steps.cpr.outputs.pull-request-operation == 'created' || + steps.cpr.outputs.pull-request-operation == 'updated') + env: + GH_TOKEN: ${{ github.token }} + run: | + gh workflow run tests.yml --repo "$GITHUB_REPOSITORY" --ref deps/laravel-auto + gh workflow run docker.yml --repo "$GITHUB_REPOSITORY" --ref deps/laravel-auto