Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$default-branch expands to name in double quotes #2100

Closed
abitrolly opened this issue Jun 23, 2023 · 6 comments
Closed

$default-branch expands to name in double quotes #2100

abitrolly opened this issue Jun 23, 2023 · 6 comments
Labels
bug Something isn't working no-issue-activity

Comments

@abitrolly
Copy link
Contributor

If your issue is relevant to this repository, please delete this text and continue to create this issue. Thank you in advance.

$default-branch expands to name in double quotes that are invalid in expressions.

abitrolly added a commit to yakshaveinc/.github that referenced this issue Jun 23, 2023
abitrolly added a commit to yakshaveinc/linux that referenced this issue Jun 23, 2023
@abitrolly
Copy link
Contributor Author

abitrolly commented Jun 23, 2023

A workaround is to use fromJSON() to remove quotes.

      if: github.ref == format('refs/heads/{0}', fromJSON('$default-branch'))

@JamesMGreene
Copy link
Contributor

That's an interesting observation, thank you for reporting it!

The hydration of a starter workflow from the templates is something handled within the GitHub backend, so I'll try to get someone to take a further look from that perspective. 🔍

With YAML, it seems to me that we would generally be fine in most cases just omitting the quotes, and leaving such things up to the starter workflow templates themselves to include when necessary. 🤔

@perj
Copy link

perj commented Sep 14, 2023

I just ran into this exact issue. Template expanded to

    if: github.ref_name == '"main"'

which doesn't work.

fromJSON seems to be the easiest workaround.

Copy link

This issue has become stale and will be closed automatically within a period of time. Sorry about that.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 22, 2023
@abitrolly
Copy link
Contributor Author

I believe it is still actual and not fixed.

Copy link

This issue has become stale and will be closed automatically within a period of time. Sorry about that.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no-issue-activity
Projects
None yet
Development

No branches or pull requests

4 participants
@perj @JamesMGreene @abitrolly and others