Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/workflows/cross-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,20 @@ jobs:
- name: Pick tag
id: pick
shell: bash
# Indirect github-context into env: vars; semgrep run-shell-injection.
env:
GH_TOKEN: ${{ github.token }}
EVENT_NAME: ${{ github.event_name }}
INPUT_TAG: ${{ inputs.tag }}
REF_NAME: ${{ github.ref_name }}
run: |
set -euo pipefail
case "${{ github.event_name }}" in
case "$EVENT_NAME" in
workflow_dispatch)
tag="${{ inputs.tag }}"
tag="$INPUT_TAG"
;;
push)
tag="${{ github.ref_name }}"
tag="$REF_NAME"
;;
workflow_run)
# CI completed successfully. Pick the most recent v-tag — if
Expand All @@ -85,8 +91,6 @@ jobs:
esac
echo "Resolved tag: $tag"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}

build:
name: ${{ matrix.os_arch }}
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,14 @@ jobs:
- name: Pick tag
id: pick
shell: bash
# Indirect via env: to keep untrusted github-context out of run:; semgrep
# run-shell-injection.
env:
INPUT_TAG: ${{ inputs.tag }}
run: |
set -euo pipefail
if [ -n "${{ inputs.tag }}" ]; then
tag="${{ inputs.tag }}"
if [ -n "$INPUT_TAG" ]; then
tag="$INPUT_TAG"
else
git fetch --tags --force origin
tag=$(git tag --sort=-creatordate --list 'v*' | head -1)
Expand Down
Loading
Loading