From 92288b7e579531ff5d813da3ffe5ccb1eb08fc01 Mon Sep 17 00:00:00 2001 From: Hafiar <289389248+0xABCD01@users.noreply.github.com> Date: Sun, 1 Nov 2026 11:35:09 +0000 Subject: [PATCH 1/2] Pass workflow values via env in release workflows Use GITHUB_REPOSITORY for release downloads. Pass the repository owner, name, and prerelease flag to the publish scripts through step environment variables. Fixes https://github.com/WordPress/sqlite-database-integration/issues/602 --- .github/workflows/release-publish.yml | 7 +++++-- .github/workflows/release-wporg.yml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index 1a43e068e..b8cdabae6 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -84,6 +84,8 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} CHANGELOG: ${{ steps.changelog.outputs.body }} + REPO_OWNER: ${{ github.repository_owner }} + REPO_NAME: ${{ github.event.repository.name }} run: | # Extract PR numbers from changelog links like [#123](...). # A changelog without matching links has no contributors to fetch. @@ -92,7 +94,7 @@ jobs: CONTRIBUTORS="" if [ -n "$PR_NUMBERS" ]; then # Build a single GraphQL query to fetch all PR authors. - QUERY='{ repository(owner: "${{ github.repository_owner }}", name: "${{ github.event.repository.name }}") {' + QUERY="{ repository(owner: \"$REPO_OWNER\", name: \"$REPO_NAME\") {" while IFS= read -r PR; do [ -n "$PR" ] && QUERY="$QUERY pr$PR: pullRequest(number: $PR) { author { login } }" done <<< "$PR_NUMBERS" @@ -110,9 +112,10 @@ jobs: MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }} BODY: ${{ steps.changelog.outputs.body }} CONTRIBUTORS: ${{ steps.contributors.outputs.list }} + PRERELEASE: ${{ steps.version.outputs.prerelease }} run: | PRERELEASE_FLAG="" - if [[ "${{ steps.version.outputs.prerelease }}" == "true" ]]; then + if [[ "$PRERELEASE" == "true" ]]; then PRERELEASE_FLAG="--prerelease" fi diff --git a/.github/workflows/release-wporg.yml b/.github/workflows/release-wporg.yml index adea793a5..68bf80c95 100644 --- a/.github/workflows/release-wporg.yml +++ b/.github/workflows/release-wporg.yml @@ -53,7 +53,7 @@ jobs: TAG: ${{ steps.resolve.outputs.tag }} run: | gh release download "$TAG" \ - --repo "${{ github.repository }}" \ + --repo "$GITHUB_REPOSITORY" \ --pattern "plugin-sqlite-database-integration.zip" \ --dir . unzip plugin-sqlite-database-integration.zip From 826d5f4db283655a293c3297291ae0c4b3b01827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Jake=C5=A1?= Date: Fri, 27 Nov 2026 15:39:22 +0100 Subject: [PATCH 2/2] Use GraphQL variables for the contributor lookup Let GitHub CLI read the owner and name from the checked-out repository and pass them as query variables. This removes the two step environment variables and the escaped quotes in the query. --- .github/workflows/release-publish.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index b8cdabae6..332306588 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -84,8 +84,6 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} CHANGELOG: ${{ steps.changelog.outputs.body }} - REPO_OWNER: ${{ github.repository_owner }} - REPO_NAME: ${{ github.event.repository.name }} run: | # Extract PR numbers from changelog links like [#123](...). # A changelog without matching links has no contributors to fetch. @@ -94,13 +92,15 @@ jobs: CONTRIBUTORS="" if [ -n "$PR_NUMBERS" ]; then # Build a single GraphQL query to fetch all PR authors. - QUERY="{ repository(owner: \"$REPO_OWNER\", name: \"$REPO_NAME\") {" + QUERY='query($owner: String!, $name: String!) { + repository(owner: $owner, name: $name) {' while IFS= read -r PR; do [ -n "$PR" ] && QUERY="$QUERY pr$PR: pullRequest(number: $PR) { author { login } }" done <<< "$PR_NUMBERS" QUERY="$QUERY } }" CONTRIBUTORS=$(gh api graphql -f query="$QUERY" \ + -F owner='{owner}' -F name='{repo}' \ --jq '[.data.repository[].author.login] | unique | map("@" + .) | join(", ")') fi echo "list=$CONTRIBUTORS" >> $GITHUB_OUTPUT