|
@@ -37,17 +37,19 @@ jobs:
|
|
|
|
|
|
|
|
- name: Resolve and validate ref
|
|
- name: Resolve and validate ref
|
|
|
id: resolve_ref
|
|
id: resolve_ref
|
|
|
|
|
+ env:
|
|
|
|
|
+ SOURCE_REF: ${{ github.event.inputs.source_ref }}
|
|
|
run: |
|
|
run: |
|
|
|
set -e
|
|
set -e
|
|
|
# Try to fetch the ref from remote
|
|
# Try to fetch the ref from remote
|
|
|
- if git fetch origin "${{ github.event.inputs.source_ref }}"; then
|
|
|
|
|
|
|
+ if git fetch origin "$SOURCE_REF"; then
|
|
|
# Remote ref exists, use it
|
|
# Remote ref exists, use it
|
|
|
- RESOLVED_SHA=$(git rev-parse "origin/${{ github.event.inputs.source_ref }}")
|
|
|
|
|
- elif git rev-parse --verify "${{ github.event.inputs.source_ref }}" >/dev/null 2>&1; then
|
|
|
|
|
|
|
+ RESOLVED_SHA=$(git rev-parse "origin/$SOURCE_REF")
|
|
|
|
|
+ elif git rev-parse --verify "$SOURCE_REF" >/dev/null 2>&1; then
|
|
|
# Local ref exists (e.g., a tag)
|
|
# Local ref exists (e.g., a tag)
|
|
|
- RESOLVED_SHA=$(git rev-parse "${{ github.event.inputs.source_ref }}")
|
|
|
|
|
|
|
+ RESOLVED_SHA=$(git rev-parse "$SOURCE_REF")
|
|
|
else
|
|
else
|
|
|
- echo "Error: ref '${{ github.event.inputs.source_ref }}' not found"
|
|
|
|
|
|
|
+ echo "Error: ref '$SOURCE_REF' not found"
|
|
|
exit 1
|
|
exit 1
|
|
|
fi
|
|
fi
|
|
|
echo "Resolved to SHA: $RESOLVED_SHA"
|
|
echo "Resolved to SHA: $RESOLVED_SHA"
|
|
@@ -78,17 +80,19 @@ jobs:
|
|
|
|
|
|
|
|
- name: Resolve and validate ref
|
|
- name: Resolve and validate ref
|
|
|
id: resolve_ref
|
|
id: resolve_ref
|
|
|
|
|
+ env:
|
|
|
|
|
+ SOURCE_REF: ${{ github.event.inputs.source_ref }}
|
|
|
run: |
|
|
run: |
|
|
|
set -e
|
|
set -e
|
|
|
# Try to fetch the ref from remote
|
|
# Try to fetch the ref from remote
|
|
|
- if git fetch origin "${{ github.event.inputs.source_ref }}"; then
|
|
|
|
|
|
|
+ if git fetch origin "$SOURCE_REF"; then
|
|
|
# Remote ref exists, use it
|
|
# Remote ref exists, use it
|
|
|
- RESOLVED_SHA=$(git rev-parse "origin/${{ github.event.inputs.source_ref }}")
|
|
|
|
|
- elif git rev-parse --verify "${{ github.event.inputs.source_ref }}" >/dev/null 2>&1; then
|
|
|
|
|
|
|
+ RESOLVED_SHA=$(git rev-parse "origin/$SOURCE_REF")
|
|
|
|
|
+ elif git rev-parse --verify "$SOURCE_REF" >/dev/null 2>&1; then
|
|
|
# Local ref exists (e.g., a tag)
|
|
# Local ref exists (e.g., a tag)
|
|
|
- RESOLVED_SHA=$(git rev-parse "${{ github.event.inputs.source_ref }}")
|
|
|
|
|
|
|
+ RESOLVED_SHA=$(git rev-parse "$SOURCE_REF")
|
|
|
else
|
|
else
|
|
|
- echo "Error: ref '${{ github.event.inputs.source_ref }}' not found"
|
|
|
|
|
|
|
+ echo "Error: ref '$SOURCE_REF' not found"
|
|
|
exit 1
|
|
exit 1
|
|
|
fi
|
|
fi
|
|
|
echo "Resolved to SHA: $RESOLVED_SHA"
|
|
echo "Resolved to SHA: $RESOLVED_SHA"
|