diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 6836442adf..902199c5f0 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -71,7 +71,7 @@ jobs: WSLENV: FORCE_COLOR:PYTEST_REQPASS:TOXENV:GITHUB_STEP_SUMMARY # Number of expected test passes, safety measure for accidental skip of # tests. Update value if you add/remove tests. - PYTEST_REQPASS: 814 + PYTEST_REQPASS: 815 steps: - name: Activate WSL1 if: "contains(matrix.shell, 'wsl')" diff --git a/examples/yamllint/.github/workflows/ci.yml b/examples/yamllint/.github/workflows/ci.yml new file mode 100644 index 0000000000..5011943703 --- /dev/null +++ b/examples/yamllint/.github/workflows/ci.yml @@ -0,0 +1,9 @@ +--- +name: ack +on: # <-- this is invalid by YAML 1.2 spec as it loads as true boolean. + pull_request_target: + types: [opened, labeled, unlabeled, synchronize] + +jobs: + ack: + uses: ansible/devtools/.github/workflows/ack.yml@main diff --git a/src/ansiblelint/rules/yaml_rule.py b/src/ansiblelint/rules/yaml_rule.py index 21936d8cec..0784706da8 100644 --- a/src/ansiblelint/rules/yaml_rule.py +++ b/src/ansiblelint/rules/yaml_rule.py @@ -73,6 +73,12 @@ def matchyaml(self, file: Lintable) -> list[MatchError]: self.severity = "VERY_LOW" if problem.level == "error": self.severity = "MEDIUM" + # Ignore truthy violation with github workflows ("on:" keys) + if problem.rule == "truthy" and file.path.parent.parts[-2:] == ( + ".github", + "workflows", + ): + continue matches.append( self.create_matcherror( # yamllint does return lower-case sentences @@ -180,6 +186,12 @@ def _fetch_skips(data: Any, collector: dict[int, set[str]]) -> dict[int, set[str [], id="rule-yaml-pass", ), + pytest.param( + "examples/yamllint/.github/workflows/ci.yml", + "yaml", + [], + id="rule-yaml-github-workflow", + ), ), ) @pytest.mark.filterwarnings("ignore::ansible_compat.runtime.AnsibleWarning")