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

partial matrix excludes incorrectly flagged as invalid #249

Closed
altendky opened this issue Nov 23, 2022 · 2 comments
Closed

partial matrix excludes incorrectly flagged as invalid #249

altendky opened this issue Nov 23, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@altendky
Copy link

(originally misreported at https://github.com/github/super-linter/issues/3016)

I regularly have matrix entries with several values such as a string for a name, another string for use in identifying this in other matrix conditional checks etc. I also end up using matrix excludes frequently. GitHub Actions itself lets you exclude based on a partial match such as arch: matrix: arm below while the Actions linter here complains that that is missing the arch: name: ARM value.

https://github.com/Chia-Network/actions/runs/6812575981?check_suite_focus=true#step:4:75

2022-06-09 12:35:44 [ERROR]   Found errors in [actionlint] linter!
2022-06-09 12:35:44 [ERROR]   Error code: 1. Command output:
------
.github/workflows/test-setup-python.yml:55:15: value {"matrix": "windows"} in "exclude" does not exist in matrix "os" combinations. possible values are {"name": "macOS", "matrix": "macos", "runs-on": {"arm": ["m1"], "intel": ["macos-latest"]}}, {"name": "Ubuntu", "matrix": "ubuntu", "runs-on": {"arm": ["Linux", "ARM64"], "intel": ["ubuntu-latest"]}}, {"name": "Windows", "matrix": "windows", "runs-on": {"intel": ["windows-latest"]}} [matrix]
   |
55 |               matrix: windows
   |               ^~~~~~~
.github/workflows/test-setup-python.yml:57:15: value {"matrix": "arm"} in "exclude" does not exist in matrix "arch" combinations. possible values are {"matrix": "arm", "name": "ARM"}, {"name": "Intel", "matrix": "intel"} [matrix]
   |
57 |               matrix: arm
   |               ^~~~~~~
------

https://github.com/Chia-Network/actions/blob/4146f33b66d7a011e5429edcf900a3c4f0c61a95/.github/workflows/test-setup-python.yml#L19-L57

      matrix:
        os:
          - name: macOS
            matrix: macos
            runs-on:
              arm: [m1]
              intel: [macos-latest]
          - name: Ubuntu
            matrix: ubuntu
            runs-on:
              arm: [Linux, ARM64]
              intel: [ubuntu-latest]
          - name: Windows
            matrix: windows
            runs-on:
              intel: [windows-latest]
        python:
          - name: '3.7'
            action: '3.7'
            check: '3.7'
          - name: '3.8'
            action: '3.8'
            check: '3.8'
          - name: '3.9'
            action: '3.9'
            check: '3.9'
          - name: '3.10'
            action: '3.10'
            check: '3.10'
        arch:
          - name: ARM
            matrix: arm
          - name: Intel
            matrix: intel
        exclude:
          - os:
              matrix: windows
            arch:
              matrix: arm
@ChristopherHX
Copy link

ChristopherHX commented Dec 7, 2022

I don't think that this feature has been documented anywhere, but I can confirm that this does actually work in GitHub Actions.

Based on this issue, I figured out that partial matching also works with arrays.

[1, 2, 3] is excluded by [], [1], [1, 2] or [1, 2, 3].

The same works with the include statement.

{ x: y, z: u } is excluded by {}, { x: y }, { z: u }, { x: y, z: u }
Empty array / object literals cause weird behavior, even if you use it in a nested object, you may want to warn if you see them

@rhysd rhysd added the bug Something isn't working label Jan 26, 2023
@rhysd rhysd closed this as completed in 9cf38f3 Aug 3, 2023
@altendky
Copy link
Author

altendky commented Aug 7, 2023

Thanks a bunch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants