Skip to content

Control the shell for run steps via DefaultShell - #430

Merged
avidenic merged 1 commit into
Fallout-build:mainfrom
avidenic:features/388-github-actions-default-shell
Jun 30, 2026
Merged

Control the shell for run steps via DefaultShell#430
avidenic merged 1 commit into
Fallout-build:mainfrom
avidenic:features/388-github-actions-default-shell

Conversation

@avidenic

@avidenic avidenic commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Closes #388.

Adds DefaultShell to GitHubActionsAttribute. When set, the workflow emits a top-level defaults.run.shell block so cross-platform matrix jobs pin one shell instead of the per-OS default (bash on Linux/macOS, pwsh on Windows).

[GitHubActions("build",
    GitHubActionsImage.WindowsLatest, GitHubActionsImage.UbuntuLatest,
    InvokedTargets = [nameof(Compile)],
    DefaultShell = "pwsh")]
defaults:
  run:
    shell: pwsh
  • Block is emitted after concurrency:, before jobs:; unset or whitespace-only emits nothing.
  • Free-string value (built-in or custom command {0} template) — raw-interpolated, consistent with the sibling Env/ConcurrencyGroup values.
  • Covers both generator run: lines (tool restore + dotnet fallout) across every matrix job.

Scoped out — per-step shell:. The issue proposed it as a secondary escape hatch; analysis dropped it. GetSteps is private and emits exactly one run step per job, so a per-step Shell field has no granularity advantage over the workflow default and no reachable setter. Clean additive follow-up if a real extension scenario needs it.

Tests — two Verify snapshot cases: default-shell (emission) and default-shell-with-permissions (placement guard vs permissions:/concurrency:). No dedicated whitespace test: the guard delegates to the BCL primitive, and the repo reserves *ValidationTest.cs for features that throw.


@avidenic
avidenic marked this pull request as ready for review June 25, 2026 12:00
@avidenic
avidenic requested a review from a team as a code owner June 25, 2026 12:00

@ChrisonSimtian ChrisonSimtian left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm, thanks for filling in the gaps with gh actions :-)

@ChrisonSimtian ChrisonSimtian added the Can Merge These PRs are just waiting to be merged, nothing more to do and maintainer has approved label Jun 26, 2026
ChrisonSimtian
ChrisonSimtian approved these changes Jun 26, 2026
@avidenic

Copy link
Copy Markdown
Contributor Author

lgtm, thanks for filling in the gaps with gh actions :-)

Glad to:)

@ChrisonSimtian
ChrisonSimtian force-pushed the features/388-github-actions-default-shell branch from b4485fd to 65c7381 Compare June 29, 2026 02:14
@ChrisonSimtian

Copy link
Copy Markdown
Collaborator

@avidenic can you rebase and let me know if it lets you merge? You got all the green ticks you need now and you're a contributor, so gh should let you merge by yourself now ;-)

Cross-platform matrix jobs silently use a different default shell per OS
(bash on Linux/macOS, pwsh on Windows), which changes script semantics.
The generator had no way to emit an explicit shell.

Add a public string DefaultShell to GitHubActionsAttribute. When set, the
workflow emits a top-level defaults.run.shell block (after concurrency,
before jobs), pinning one shell for every run: step across all matrix jobs.
Free-string value; unset or whitespace-only emits no block. Per-step shell
was deliberately scoped out (one run step per job; no granularity gain).

Covered by two Verify snapshot cases (default-shell, and a
default-shell-with-permissions ordering guard).
@avidenic
avidenic force-pushed the features/388-github-actions-default-shell branch from ab5b963 to fe6f696 Compare June 30, 2026 07:15
@avidenic

Copy link
Copy Markdown
Contributor Author

@ChrisonSimtian hey - I squashed and rebased, no option to merge though.

@ChrisonSimtian

Copy link
Copy Markdown
Collaborator

@avidenic my apologies, I thought I already gave you write access, should work now :-)

@avidenic

Copy link
Copy Markdown
Contributor Author

@ChrisonSimtian I think GH does not like us today:

image

@ChrisonSimtian

Copy link
Copy Markdown
Collaborator

@ChrisonSimtian I think GH does not like us today:

image It'll work once you've accepted the invite :-)

@avidenic

Copy link
Copy Markdown
Contributor Author

@ChrisonSimtian sorry, about that. Got buried in the notifications. Tnx for being patient with me - I am usually on the other side where I give out permissions :D

@avidenic
avidenic merged commit 668e6ac into Fallout-build:main Jun 30, 2026
1 check passed
@avidenic
avidenic deleted the features/388-github-actions-default-shell branch June 30, 2026 08:02
@ChrisonSimtian ChrisonSimtian added the enhancement New feature or request label Jul 11, 2026
@dennisdoomen dennisdoomen changed the title [GitHubActions] generator: control the shell for run steps via DefaultShell Control the shell for run steps via DefaultShell Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Can Merge These PRs are just waiting to be merged, nothing more to do and maintainer has approved enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GitHubActions] generator: control the shell for run steps (defaults.run.shell + per-step shell:)

2 participants