Skip to content

fix(workflow): repair always-skipped 'Replace repo owner' if-syntax#19

Merged
marksverdhei merged 1 commit into
mainfrom
fix/template-init-if-syntax
Jun 26, 2026
Merged

fix(workflow): repair always-skipped 'Replace repo owner' if-syntax#19
marksverdhei merged 1 commit into
mainfrom
fix/template-init-if-syntax

Conversation

@marksverdhei

Copy link
Copy Markdown
Owner

Bug

```yaml

  • name: Replace repo owner
    if: ${{ github.event.repository.owner.login }} != marksverdhei
    ```

This mixes `${{ }}` pre-substitution with a bare-text right-hand side. GHA evaluates the entire `if` value as an expression after substitution:

  1. `${{ github.event.repository.owner.login }}` is substituted → e.g. `someuser`
  2. The literal becomes: `someuser != marksverdhei`
  3. GHA parses that as an expression. Both `someuser` and `marksverdhei` are unquoted identifiers → resolved as undefined context refs (both `null`)
  4. `null != null` is `false`
  5. Step always skipped

Effect: every new repo created from this template kept its `marksverdhei` references unreplaced. The bug never bit Markus's own usage of the template (other workflows would have caught it cosmetically) but is wrong for anyone else cloning the template — and silently so.

Fix

```yaml

  • name: Replace repo owner
    if: github.event.repository.owner.login != 'marksverdhei'
    ```

Move the comparison entirely inside one expression scope. The quoted literal and the property reference now share the same evaluator, and the step runs whenever the owner isn't `marksverdhei` (matching the intent in the inline comment).

Why no test

This is a CI workflow — no local-runnable test suite to add to. The next time a non-marksverdhei user (real or test) clones from this template, the step will run and `marksverdhei` references will be replaced as documented.

…yntax

The condition was written as:

    if: ${{ github.event.repository.owner.login }} != marksverdhei

This mixes ${{ }} pre-substitution with bare-text comparison. GHA
evaluates the value as an expression after substitution, so the literal
becomes '<owner_login> != marksverdhei'. Both sides are unquoted
identifiers that resolve to undefined context refs (null), and 'null !=
null' is false. Net effect: the step was *always skipped*, so every
new repo created from this template kept its marksverdhei references
unreplaced.

Moves the comparison fully inside one expression scope:

    if: github.event.repository.owner.login != 'marksverdhei'

The quoted literal and the property reference now share the same
expression evaluator, and the step runs whenever the owner isn't
marksverdhei (the intent expressed in the comment).
@marksverdhei marksverdhei merged commit dea86a4 into main Jun 26, 2026
2 checks passed
@marksverdhei marksverdhei deleted the fix/template-init-if-syntax branch June 26, 2026 00:11
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.

1 participant