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

if condition rejected by GitHub not flagged #83

Open
ekohl opened this issue Jan 24, 2025 · 1 comment
Open

if condition rejected by GitHub not flagged #83

ekohl opened this issue Jan 24, 2025 · 1 comment
Labels
pr-welcome This would be a good fix/feature, but the maintainer isn't planning on doing the work

Comments

@ekohl
Copy link

ekohl commented Jan 24, 2025

From https://github.com/theforeman/foreman_dhcp_browser/blob/e80fc0e5ffdc1f30ba23ebf3ad9314b456dea06e/.github/workflows/release.yml#L14 there's this bit:

jobs:
  release:
    if: github.repository_owner == "theforeman"

When running it I see

 Invalid workflow file: .github/workflows/release.yml#L14
The workflow is not valid. .github/workflows/release.yml (Line: 14, Col: 9): Unexpected symbol: '"theforeman"'. Located at position 28 within expression: github.repository_owner == "theforeman"

But with action-validator 0.6.0 I see:

$ wget https://github.com/mpalmer/action-validator/releases/download/v0.6.0/action-validator_linux_amd64
$ chmod +x action-validator_linux_amd64
$ ./action-validator_linux_amd64 release.yml
$

I also verified that if I explicitly create an error it is shown.

Reading https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/using-conditions-to-control-job-execution#example-only-run-job-for-specific-repository I see I should have used single quotes:

jobs:
  release:
    if: github.repository_owner == 'theforeman'
@mpalmer mpalmer added the pr-welcome This would be a good fix/feature, but the maintainer isn't planning on doing the work label Jan 25, 2025
@mpalmer
Copy link
Owner

mpalmer commented Jan 25, 2025

Yeah, we don't do any validation of the contents of fields at present, with the exception of a couple of special cases like paths. A PR implementing such validation would be warmly received.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-welcome This would be a good fix/feature, but the maintainer isn't planning on doing the work
Projects
None yet
Development

No branches or pull requests

2 participants