Merge pull request #17698 from Homebrew/better-input-handling

workflows/vendor-gems: handle input string more robustly
This commit is contained in:
Ruoyu Zhong 2024-07-13 14:24:23 -04:00 committed by GitHub
commit 7c90c2df92
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -58,7 +58,7 @@ jobs:
id: checkout id: checkout
if: github.event_name == 'pull_request_target' || github.event_name == 'workflow_dispatch' if: github.event_name == 'pull_request_target' || github.event_name == 'workflow_dispatch'
run: | run: |
gh pr checkout '${{ github.event.pull_request.number || github.event.inputs.pull_request }}' gh pr checkout "${PR}"
branch="$(git branch --show-current)" branch="$(git branch --show-current)"
echo "branch=${branch}" >> "$GITHUB_OUTPUT" echo "branch=${branch}" >> "$GITHUB_OUTPUT"
@ -66,6 +66,7 @@ jobs:
gem_name="$(echo "${branch}" | sed -E 's|.*/||;s|(.*)-.*$|\1|')" gem_name="$(echo "${branch}" | sed -E 's|.*/||;s|(.*)-.*$|\1|')"
echo "gem_name=${gem_name}" >> "$GITHUB_OUTPUT" echo "gem_name=${gem_name}" >> "$GITHUB_OUTPUT"
env: env:
PR: ${{ github.event.pull_request.number || github.event.inputs.pull_request }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }} working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}