Skip to content

Commit 758da32

Browse files
authored
Remove inline expressions from release scripts (#604)
Use GITHUB_REPOSITORY for release downloads and pass the prerelease flag through the environment. Pass the repository owner and name to the contributor query as GraphQL variables. Fixes #602.
1 parent 3e75ae0 commit 758da32

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
@@ -92,13 +92,15 @@ jobs:
9292
CONTRIBUTORS=""
9393
if [ -n "$PR_NUMBERS" ]; then
9494
# Build a single GraphQL query to fetch all PR authors.
95-
QUERY='{ repository(owner: "${{ github.repository_owner }}", name: "${{ github.event.repository.name }}") {'
95+
QUERY='query($owner: String!, $name: String!) {
96+
repository(owner: $owner, name: $name) {'
9697
while IFS= read -r PR; do
9798
[ -n "$PR" ] && QUERY="$QUERY pr$PR: pullRequest(number: $PR) { author { login } }"
9899
done <<< "$PR_NUMBERS"
99100
QUERY="$QUERY } }"
100101
101102
CONTRIBUTORS=$(gh api graphql -f query="$QUERY" \
103+
-F owner='{owner}' -F name='{repo}' \
102104
--jq '[.data.repository[].author.login] | unique | map("@" + .) | join(", ")')
103105
fi
104106
echo "list=$CONTRIBUTORS" >> $GITHUB_OUTPUT
@@ -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)