axodotdev / axodotdev/cargo-dist

Customizing CI panics if steps don't start with the name key

Open
#1,739 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.1k
Forks
149
Avg merge
1d 11h
Merged PRs (30d)
32

Description

Version: 0.28.0

### Steps to reproduce

Set this in `dist-workspace.toml`:

```toml
[workspace]
members = ["cargo:."]

[dist]
cargo-dist-version = "0.28.0"
ci = "github"
installers = ["shell", "powershell", "msi"]
targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"]
install-path = "CARGO_HOME"
install-updater = false
pr-run-mode = "upload"
github-build-setup = "build-setup.yml" # This is the relevant one
```
Then in ` .github/workflows/build-setup.yml`:

```yaml
- uses: extractions/setup-just@v2
```

Running `dist init` (just hitting enter a few times) panics with:

```console
x Failed to render template
`-> Backtrace:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1: BaseThreadInitThunk
at
2: RtlUserThreadStart
at

undefined value (in ci/github/release.yml:238)
,-[238:19]
237 | {{%- for step in github_build_setup %}}
238 | - name: {{{ step.name }}}
: ^^^^^^^^^
239 | {{%- if step.id is not undefined %}}
`----
help: this is a bug in dist, let us know and we'll fix it: https://github.com/axodotdev/cargo-dist/issues/new
```

If you add `name` as the first key ` .github/workflows/build-setup.yml`:

```yaml
- name: Install just
uses: extractions/setup-just@v2
```
It runs with no issues.

Running actions like this is often done without a name because it can be noisy to name every little action step like `checkout` and `rust-cache`, so I think this should be fixed (although it's not urgent obviously).

Contributor guide

Open the contributing guide

Research direction

Start at ci/github/release.yml around line 238 and trace how dist init renders steps from github-build-setup.yml. Reproduce the unnamed extractions/setup-just@v2 step; done means dist init completes without a panic and renders the step when name is absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, rust
Domain
ci-cd
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.