Skip to content

Commit 92288b7

Browse files
0xABCD01JanJakes
authored andcommitted
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 WordPress#602
1 parent 3e75ae0 commit 92288b7

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎.github/workflows/release-publish.yml‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ jobs:
8484
env:
8585
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8686
CHANGELOG: ${{ steps.changelog.outputs.body }}
87+
REPO_OWNER: ${{ github.repository_owner }}
88+
REPO_NAME: ${{ github.event.repository.name }}
8789
run: |
8890
# Extract PR numbers from changelog links like [#123](...).
8991
# A changelog without matching links has no contributors to fetch.
@@ -92,7 +94,7 @@ jobs:
9294
CONTRIBUTORS=""
9395
if [ -n "$PR_NUMBERS" ]; then
9496
# Build a single GraphQL query to fetch all PR authors.
95-
QUERY='{ repository(owner: "${{ github.repository_owner }}", name: "${{ github.event.repository.name }}") {'
97+
QUERY="{ repository(owner: \"$REPO_OWNER\", name: \"$REPO_NAME\") {"
9698
while IFS= read -r PR; do
9799
[ -n "$PR" ] && QUERY="$QUERY pr$PR: pullRequest(number: $PR) { author { login } }"
98100
done <<< "$PR_NUMBERS"
@@ -110,9 +112,10 @@ jobs:
110112
MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
111113
BODY: ${{ steps.changelog.outputs.body }}
112114
CONTRIBUTORS: ${{ steps.contributors.outputs.list }}
115+
PRERELEASE: ${{ steps.version.outputs.prerelease }}
113116
run: |
114117
PRERELEASE_FLAG=""
115-
if [[ "${{ steps.version.outputs.prerelease }}" == "true" ]]; then
118+
if [[ "$PRERELEASE" == "true" ]]; then
116119
PRERELEASE_FLAG="--prerelease"
117120
fi
118121

‎.github/workflows/release-wporg.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
TAG: ${{ steps.resolve.outputs.tag }}
5454
run: |
5555
gh release download "$TAG" \
56-
--repo "${{ github.repository }}" \
56+
--repo "$GITHUB_REPOSITORY" \
5757
--pattern "plugin-sqlite-database-integration.zip" \
5858
--dir .
5959
unzip plugin-sqlite-database-integration.zip

0 commit comments

Comments
 (0)