9191jobs :
9292 publish :
9393 runs-on : ubuntu-latest
94+ env :
95+ REGISTRY_BRANCH : ${{ inputs.registry_branch }}
96+ REGISTRY : ${{ inputs.registry }}
97+ REGISTRY_FORK : ${{ inputs.registry_fork }}
98+ TAG_NAME : ${{ inputs.tag_name }}
9499 steps :
95100 - name : Checkout the module repository
96101@@ -229,6 +234,11 @@ jobs:
229234 - name : Push to fork
230235 id : push-to-fork
231236 working-directory : bazel-central-registry
237+ env :
238+ # Set the author to the actor of this workflow. Use the github-provided
239+ # noreply email address: https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/setting-your-commit-email-address.
240+ AUTHOR_NAME : ${{ github.actor }}
241+ AUTHOR_EMAIL : ${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com
232242 run : |
233243 set -o errexit -o nounset -o pipefail
234244
@@ -237,15 +247,10 @@ jobs:
237247 COMMITTER_NAME="github-actions[bot]"
238248 COMMITTER_EMAIL="41898282+github-actions[bot]@users.noreply.github.com"
239249
240- # Set the author to the actor of this workflow. Use the github-provided
241- # noreply email address: https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/setting-your-commit-email-address.
242- AUTHOR_NAME="${{ github.actor }}"
243- AUTHOR_EMAIL="${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
244-
245250 # Use an authorized remote url to push to the fork
246- git remote add authed-fork https://x-access-token:${{ secrets.publish_token }}@github.com/${{ inputs.registry_fork } }.git
251+ git remote add authed-fork https://x-access-token:${{ secrets.publish_token }}@github.com/${REGISTRY_FORK }.git
247252
248- BRANCH="${{ steps.create-final-entry.outputs.module-names }}-${{ inputs.tag_name } }"
253+ BRANCH="${{ steps.create-final-entry.outputs.module-names }}-${TAG_NAME }"
249254 git checkout -b "${BRANCH}"
250255 git add .
251256 git -c "author.name=${AUTHOR_NAME}" \
@@ -260,34 +265,36 @@ jobs:
260265
261266 - name : Prepare PR variables
262267 id : pr-vars
268+ env :
269+ REPOSITORY : ${{ inputs.repository }}
263270 run : |
264271 set -o errexit -o nounset -o pipefail
265272
266273 TITLE="${{ steps.create-final-entry.outputs.short-description }}"
267274 echo "title=${TITLE}" >> $GITHUB_OUTPUT
268275
269276 echo "body<<EOF" >> $GITHUB_OUTPUT
270- echo -e "Release: https://github.com/${{ inputs.repository }} /releases/tag/${{ inputs.tag_name } }\n" >> $GITHUB_OUTPUT
277+ echo -e "Release: https://github.com/${REPOSITORY} /releases/tag/${TAG_NAME }\n" >> $GITHUB_OUTPUT
271278 echo "_Automated by [Publish to BCR](https://github.com/bazel-contrib/publish-to-bcr)_" >> $GITHUB_OUTPUT
272279 echo "EOF" >> $GITHUB_OUTPUT
273280
274281 - name : Open pull request
275282 if : ${{ inputs.open_pull_request }}
283+ env :
284+ DRAFT : ${{ inputs.draft }}
276285 working-directory : bazel-central-registry
277286 run : |
278287 set -o errexit -o nounset -o pipefail
279288
280- REGISTRY_FORK="${{ inputs.registry_fork }}"
281289 FORK_OWNER="${REGISTRY_FORK%%/*}"
282290 BRANCH="${{ steps.push-to-fork.outputs.branch }}"
283- DRAFT="${{ inputs.draft }}"
284291 MAINTAINER_CAN_MODIFY=true
285292
286293 REQUEST_BODY=$(jq --null-input \
287294 --arg title "${{ steps.pr-vars.outputs.title }}" \
288295 --arg body "${{ steps.pr-vars.outputs.body }}" \
289296 --arg head "${FORK_OWNER}:${BRANCH}" \
290- --arg base ${{ inputs.registry_branch } } \
297+ --arg base ${REGISTRY_BRANCH } \
291298 --argjson draft "${DRAFT}" \
292299 --argjson maintainer_can_modify "${MAINTAINER_CAN_MODIFY}" \
293300 '{title: $title, body: $body, head: $head, base: $base, maintainer_can_modify: $maintainer_can_modify, draft: $draft}')
@@ -306,7 +313,7 @@ jobs:
306313 --header "Accept: application/vnd.github+json" \
307314 --header "Authorization: Bearer ${{ secrets.publish_token }}" \
308315 --header "X-GitHub-Api-Version: 2022-11-28" \
309- https://api.github.com/repos/${{ inputs.registry } }/pulls \
316+ https://api.github.com/repos/${REGISTRY }/pulls \
310317 --data "${REQUEST_BODY}"
311318 )
312319
@@ -329,7 +336,6 @@ jobs:
329336 run : |
330337 set -o errexit -o nounset -o pipefail
331338
332- REGISTRY_FORK="${{ inputs.registry_fork }}"
333339 FORK_OWNER="${REGISTRY_FORK%%/*}"
334340 FORK_REPO="${REGISTRY_FORK##*/}"
335341 TITLE=$(jq --raw-input --raw-output @uri <<<"${{ steps.pr-vars.outputs.title }}")
@@ -339,4 +345,4 @@ jobs:
339345 echo -e "Create the pull request manually by visiting:"
340346
341347 # https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/using-query-parameters-to-create-a-pull-request
342- echo "https://github.com/${{ inputs.registry }} /compare/${{ inputs.registry_branch } }...${FORK_OWNER}:${FORK_REPO}:${{ steps.push-to-fork.outputs.branch }}?title=${TITLE}&body=${BODY}&quick_pull=1"
348+ echo "https://github.com/${REGISTRY} /compare/${REGISTRY_BRANCH }...${FORK_OWNER}:${FORK_REPO}:${{ steps.push-to-fork.outputs.branch }}?title=${TITLE}&body=${BODY}&quick_pull=1"
0 commit comments