Skip to content

Conversation

@BYK
Copy link
Member

@BYK BYK commented Dec 26, 2025

Summary

Add workflow_call trigger to release.yml so external repositories can call it as a reusable workflow, providing an easier adoption path for Craft.

Changes

.github/workflows/release.yml

  • Added workflow_call trigger with inputs mirroring action.yml
  • Added workflow outputs (version, branch, sha, previous_tag, changelog)
  • Made build job conditional (only for Craft's own dogfooding releases)
  • Handles both:
    • Craft releases: Uses ./ action with release bot token
    • External repos: Uses getsentry/craft@v2 with inherited secrets

docs/src/content/docs/github-actions.md

  • Restructured "Prepare Release" section to present both options
  • Added comparison table for workflow vs action
  • Updated examples and "Tips" section

Usage

External repos can now use either approach:

# Simple: Reusable workflow
jobs:
  release:
    uses: getsentry/craft/.github/workflows/release.yml@v2
    with:
      version: ${{ inputs.version }}
    secrets: inherit
# Flexible: Composite action with custom steps
jobs:
  release:
    steps:
      - uses: actions/checkout@v4
      - run: # custom pre-step
      - uses: getsentry/craft@v2
      - run: # custom post-step

Add workflow_call trigger to release.yml so external repositories can call it
as a reusable workflow. This provides two options for adopting Craft:

- Reusable workflow: Zero-config, batteries-included release flow
- Composite action: Flexible, allows custom pre/post steps

The workflow handles both Craft's own releases (dogfooding with local action)
and external repos (using published getsentry/craft@v2 action).

Documentation updated to present both options with comparison table.
@github-actions
Copy link
Contributor

Suggested Version Bump

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • feat(actions): Make release workflow reusable for external repos by @BYK in #672
  • feat(changelog): Add changelog preview action and CLI command by @BYK in #669

Documentation 📚

  • docs: New documentation site! by @BYK in #668

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 26, 2025

PR Preview Action v1.7.0
Preview removed because the pull request was closed.
2025-12-27 07:50 UTC

@BYK BYK marked this pull request as ready for review December 27, 2025 07:23
id: craft-local
uses: ./
env:
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: When workflow_dispatch is run on a fork, the token generation step is skipped, but the craft-local step still tries to use its output, resulting in an empty GITHUB_TOKEN.
Severity: HIGH | Confidence: High

🔍 Detailed Analysis

When the workflow is triggered via workflow_dispatch on a fork of the getsentry/craft repository, the token generation step is skipped. This is because its condition if: github.event_name == 'workflow_dispatch' && github.repository == 'getsentry/craft' evaluates to false on a fork. The subsequent craft-local step, however, is still executed and attempts to use the output from the skipped step via ${{ steps.token.outputs.token }}. In GitHub Actions, referencing an output from a skipped step results in an empty string. This causes the craft action to run with an empty GITHUB_TOKEN, leading to authentication failures and GitHub API errors. This bug prevents contributors from successfully testing the workflow on their forks.

💡 Suggested Fix

Add a condition to the craft-local step to ensure it only runs when the token generation step has also run. The condition should mirror the one on the token step: if: github.event_name == 'workflow_dispatch' && github.repository == 'getsentry/craft'.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: .github/workflows/release.yml#L121

Potential issue: When the workflow is triggered via `workflow_dispatch` on a fork of the
`getsentry/craft` repository, the token generation step is skipped. This is because its
condition `if: github.event_name == 'workflow_dispatch' && github.repository ==
'getsentry/craft'` evaluates to false on a fork. The subsequent `craft-local` step,
however, is still executed and attempts to use the output from the skipped step via `${{
steps.token.outputs.token }}`. In GitHub Actions, referencing an output from a skipped
step results in an empty string. This causes the `craft` action to run with an empty
`GITHUB_TOKEN`, leading to authentication failures and GitHub API errors. This bug
prevents contributors from successfully testing the workflow on their forks.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 7958081

@BYK BYK enabled auto-merge (squash) December 27, 2025 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants