Skip to content

Commit 299b509

Browse files
authored
fix(changelog-preview): Replace deleted install sub-action with inline install (#706)
## Problem PR #705 removed the `install/` sub-action, but the `changelog-preview.yml` workflow was still referencing it: ```yaml uses: getsentry/craft/install@master ``` This broke the changelog preview workflow for all PRs. ## Solution Replace the deleted sub-action reference with inline install logic that downloads Craft from release: - Respects `craft-version` input (defaults to latest) - Falls back to latest if specified version doesn't exist - Adds robust error handling with `set -euo pipefail` - Verifies download succeeded and binary is valid - Runs `craft --version` to confirm installation ## Why No Dogfooding? Unlike the main release action, this workflow **does not dogfood** (use build artifacts from PRs) because: 1. **Different workflow runs**: The build workflow runs separately, and artifacts are scoped to that workflow run 2. **Complexity**: Cross-workflow artifact fetching would require additional dependencies and logic 3. **Timing issues**: Build workflow might still be running when changelog-preview starts 4. **Lower criticality**: Changelog preview is less critical than the main release action For changelog previews, we always use the released version of Craft.
1 parent ed9bce6 commit 299b509

File tree

1 file changed

+45
-4
lines changed

1 file changed

+45
-4
lines changed

.github/workflows/changelog-preview.yml

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,52 @@ jobs:
5252
with:
5353
fetch-depth: 0
5454

55-
# Install Craft using the shared install action
55+
# Install Craft from release
56+
# Note: Dogfooding (using build artifact from this PR) is not feasible here because:
57+
# 1. The build workflow runs separately and artifacts are scoped to that workflow run
58+
# 2. Cross-workflow artifact fetching would require additional complexity
59+
# 3. The changelog preview is less critical than the main release action
60+
# For now, we always use the released version for changelog previews.
5661
- name: Install Craft
57-
uses: getsentry/craft/install@master
58-
with:
59-
craft-version: ${{ inputs.craft-version || 'latest' }}
62+
shell: bash
63+
run: |
64+
set -euo pipefail
65+
66+
CRAFT_VERSION="${{ inputs.craft-version || 'latest' }}"
67+
68+
if [[ "$CRAFT_VERSION" == "latest" || -z "$CRAFT_VERSION" ]]; then
69+
echo "Downloading latest Craft release..."
70+
CRAFT_URL=$(curl -fsSL "https://api.github.com/repos/getsentry/craft/releases/latest" \
71+
| jq -r '.assets[] | select(.name == "craft") | .browser_download_url')
72+
else
73+
CRAFT_URL="https://github.com/getsentry/craft/releases/download/${CRAFT_VERSION}/craft"
74+
echo "Downloading Craft ${CRAFT_VERSION}..."
75+
76+
# Fallback to latest if specified version doesn't exist
77+
if ! curl -sfI "$CRAFT_URL" >/dev/null 2>&1; then
78+
echo "Release not found for version '${CRAFT_VERSION}', falling back to latest..."
79+
CRAFT_URL=$(curl -fsSL "https://api.github.com/repos/getsentry/craft/releases/latest" \
80+
| jq -r '.assets[] | select(.name == "craft") | .browser_download_url')
81+
fi
82+
fi
83+
84+
# Verify we have a valid URL
85+
if [[ -z "$CRAFT_URL" ]]; then
86+
echo "::error::Failed to determine Craft download URL"
87+
exit 1
88+
fi
89+
90+
echo "Installing Craft from: ${CRAFT_URL}"
91+
sudo curl -fsSL -o /usr/local/bin/craft "$CRAFT_URL"
92+
sudo chmod +x /usr/local/bin/craft
93+
94+
# Verify installation
95+
if [[ ! -s /usr/local/bin/craft ]]; then
96+
echo "::error::Downloaded Craft binary is empty or missing"
97+
exit 1
98+
fi
99+
100+
craft --version
60101
61102
- name: Generate Changelog Preview
62103
shell: bash

0 commit comments

Comments
 (0)