From 93c8deb5e5aa04779b6212a15ecadf32204553d4 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 13 Aug 2026 05:59:03 +0700 Subject: [PATCH] Rebuild with new commit --allow-empty on rector-src when rector-src is tagged on trigger Rebuild --- .../dispatch_build_scoped_rector.yaml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/dispatch_build_scoped_rector.yaml diff --git a/.github/workflows/dispatch_build_scoped_rector.yaml b/.github/workflows/dispatch_build_scoped_rector.yaml new file mode 100644 index 00000000..2391f54b --- /dev/null +++ b/.github/workflows/dispatch_build_scoped_rector.yaml @@ -0,0 +1,49 @@ +# github action that rebuilds https://github.com/rectorphp/rector +# with the freshly merged rector-downgrade-php main +name: Dispatch Build Scoped Rector + +on: + push: + branches: + - main + workflow_dispatch: null + +jobs: + dispatch_build_scoped_rector: + # only for this repository, not forks + if: github.repository == 'rectorphp/rector-downgrade-php' + + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - + name: "Wait 20 seconds after push" + run: sleep 20 + + - + name: "Check whether rector-src main is a release tag commit" + env: + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + GH_TOKEN: ${{ secrets.ACCESS_TOKEN }} + run: | + RECTOR_SRC="https://github.com/rectorphp/rector-src.git" + + MAIN_SHA=$(git ls-remote $RECTOR_SRC refs/heads/main | cut -f1) + if [ -z "$MAIN_SHA" ]; then + echo "Could not resolve rector-src main" + exit 1 + fi + + # lightweight tags are listed with the commit itself, annotated ones with a "^{}" line + if git ls-remote --tags $RECTOR_SRC | grep -q "^${MAIN_SHA}"; then + echo "rector-src main $MAIN_SHA is tagged, creating a rebuild commit" + git clone --depth 1 --branch main "https://x-access-token:${ACCESS_TOKEN}@github.com/rectorphp/rector-src.git" rector-src + cd rector-src + git config user.name "TomasVotruba" + git config user.email "tomas.vot@gmail.com" + git commit --allow-empty -m 'Rebuild' -a + git push origin main + else + gh workflow run build_scoped_rector.yaml --repo rectorphp/rector-src --ref main + fi