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

GH Actions workflows probably broken since #2461 #2463

Closed
tom-reinders opened this issue Sep 5, 2022 · 10 comments
Closed

GH Actions workflows probably broken since #2461 #2463

tom-reinders opened this issue Sep 5, 2022 · 10 comments
Labels
issue:bug Report errors or unexpected behavior (auto-generated by issue forms)

Comments

@tom-reinders
Copy link

Area with issue?

JSON Schema

✔️ Expected Behavior

To see file as correct

❌ Actual Behavior

I get the following alert

Schema validation: Validates to more than one variant

on the lines:

          TEST_VALUE_5: ${{ secrets.TEST_VALUE_5 }}
          TEST_VALUE_6: ${{ secrets.TEST_VALUE_6 }}
          path: ~/.composer/cache
          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
          restore-keys: ${{ runner.os }}-composer-
  TEST_VALUE_1: ${{ secrets.TEST_VALUE_1 }}
  TEST_VALUE_2: ${{ secrets.TEST_VALUE_2 }}
  TEST_VALUE_3: 'TEST VALUE 3'
  TEST_VALUE_4: ${{ secrets.TEST_VALUE_4 }}

YAML or JSON file that does not work.

name: "Example workflow for schema store"

on:
  push:
    branches:
    - '**'

jobs:
  vulnerabilities:
    name: Example workflow for schema store
    runs-on: ubuntu-latest
    steps:
      - name: Setup ssh keys
        env:
          TEST_VALUE_5: ${{ secrets.TEST_VALUE_5 }}
          TEST_VALUE_6: ${{ secrets.TEST_VALUE_6 }}
        run: |-
          # Just some fake commands
          apt-get update
          apt-get install -y vim
      - name: Cache composer
        uses: actions/cache@v3
        with:
          path: ~/.composer/cache
          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
          restore-keys: ${{ runner.os }}-composer-
env:
  TEST_VALUE_1: ${{ secrets.TEST_VALUE_1 }}
  TEST_VALUE_2: ${{ secrets.TEST_VALUE_2 }}
  TEST_VALUE_3: 'TEST VALUE 3'
  TEST_VALUE_4: ${{ secrets.TEST_VALUE_4 }}

IDE or code editor.

IntelliJ and it's derivatives

Are you making a PR for this?

No, someone else must create the PR.

@tom-reinders tom-reinders added the issue:bug Report errors or unexpected behavior (auto-generated by issue forms) label Sep 5, 2022
@1oglop1
Copy link

1oglop1 commented Sep 5, 2022

I can confirm the problem
image
image

@beeequeue
Copy link
Contributor

Yep, most valid workflows I have are reported as broken.

@1oglop1
Copy link

1oglop1 commented Sep 5, 2022

@webknjaz
Copy link
Contributor

webknjaz commented Sep 5, 2022

@1oglop1 might be. Should've probably used some sort of exclusion there, like [^(}})]. Mind testing? I don't use it with editors but with this pre-commit check https://github.com/python-jsonschema/check-jsonschema. That check hasn't synched the schema yet so I've temporarily just committed a local copy (sphinx-contrib/sphinxcontrib-towncrier@7321bd5#diff-63a9c44a44acf85fea213a857769990937107cf072831e1a26808cfde9d096b9R29). I can say that it made my workflows pass the check but maybe there's not enough tests in this repo covering such cases.

@webknjaz
Copy link
Contributor

webknjaz commented Sep 5, 2022

For anybody trying to find a fix, please, try checking against https://github.com/sphinx-contrib/sphinxcontrib-towncrier/blob/master/.github/workflows/tox-tests.yaml, as a regression test.

@webknjaz
Copy link
Contributor

webknjaz commented Sep 5, 2022

Yep, most valid workflows I have are reported as broken.

Sounds like it'd be a good idea to put a copy of them into https://github.com/SchemaStore/schemastore/tree/master/src/test/github-workflow.

@webknjaz
Copy link
Contributor

webknjaz commented Sep 5, 2022

@1oglop1 looking closer, I recall seeing this error with "missing uses" lately. Maybe even before this patch. In my case, the problem was that I was using runs-on: Ubuntu-latest but the values hardcoded in the schema were lower-case and changing to runs-on: ubuntu-latest fixed that. But I do agree that such vague schema validation errors tend to be confusing. This was why I submitted the PR in the first place when I finally bisected the file to see what was causing the problem.

@tom-reinders
Copy link
Author

@webknjaz I can already see that

[^(}})]

is not valid regex, what you whould need to do is more like a negative lookahead/lookbehind kind of thing, but that feels like its a lot harder to do to me.

GerryFerdinandus added a commit that referenced this issue Sep 5, 2022
* fix issue #2463 GH Actions workflows

two items in OneOff is true. thats is why IntelliJ give error.
"$ref": "..." must be without other keyword in draft 04..07

* add test file mentioned in issue #2463
@GerryFerdinandus
Copy link
Contributor

@tom-reinders
Can you close this issue if PR #2465 fixed it?

@tom-reinders
Copy link
Author

Thanks for fixing it

jmatias pushed a commit to jmatias/schemastore that referenced this issue Sep 20, 2022
* fix issue SchemaStore#2463 GH Actions workflows

two items in OneOff is true. thats is why IntelliJ give error.
"$ref": "..." must be without other keyword in draft 04..07

* add test file mentioned in issue SchemaStore#2463
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue:bug Report errors or unexpected behavior (auto-generated by issue forms)
Projects
None yet
Development

No branches or pull requests

5 participants