├── .ansible-lint ├── .config └── dictionary.txt ├── .github ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── dependabot.yml ├── release-drafter.yml └── workflows │ ├── ack.yml │ ├── push.yml │ ├── release.yml │ ├── self-test.yml │ └── tox.yml ├── .gitignore ├── .pre-commit-config.yaml ├── README.md ├── action.yml ├── cspell.config.yaml ├── license └── tox.ini /.ansible-lint: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | exclude_paths: 4 | - .github/ 5 | -------------------------------------------------------------------------------- /.config/dictionary.txt: -------------------------------------------------------------------------------- 1 | CTYPE 2 | REQPASS 3 | RULESDIR 4 | TOXENV 5 | ansiblelint 6 | autofix 7 | autoupdate 8 | codespell 9 | commitlint 10 | deps 11 | dists 12 | minversion 13 | nocolor 14 | notest 15 | parseable 16 | setuptools 17 | 18 | # Names 19 | stoe 20 | Stölzle 21 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @ansible/devtools 2 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Community Code of Conduct 2 | 3 | Please see the official [Ansible Community Code of Conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html). 4 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | -------------------------------------------------------------------------------- /.github/release-drafter.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # see https://github.com/ansible/devtools 3 | _extends: ansible/devtools 4 | -------------------------------------------------------------------------------- /.github/workflows/ack.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # See https://github.com/ansible/devtools/blob/main/.github/workflows/ack.yml 3 | name: ack 4 | on: 5 | pull_request_target: 6 | types: [opened, labeled, unlabeled, synchronize] 7 | 8 | jobs: 9 | ack: 10 | uses: ansible/devtools/.github/workflows/ack.yml@main 11 | -------------------------------------------------------------------------------- /.github/workflows/push.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # See https://github.com/ansible/devtools/blob/main/.github/workflows/push.yml 3 | name: push 4 | on: 5 | push: 6 | branches: 7 | - main 8 | - "releases/**" 9 | - "stable/**" 10 | 11 | jobs: 12 | ack: 13 | uses: ansible/devtools/.github/workflows/push.yml@main 14 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # https://github.com/marketplace/actions/actions-tagger 3 | name: release 4 | 5 | "on": 6 | release: 7 | types: [published, edited] 8 | workflow_dispatch: 9 | 10 | jobs: 11 | actions-tagger: 12 | runs-on: windows-latest 13 | steps: 14 | - uses: Actions-R-Us/actions-tagger@latest 15 | -------------------------------------------------------------------------------- /.github/workflows/self-test.yml: -------------------------------------------------------------------------------- 1 | name: self-test 2 | on: 3 | - push 4 | - pull_request 5 | 6 | jobs: 7 | self-test: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v3 11 | - name: Self test 12 | uses: ./ 13 | -------------------------------------------------------------------------------- /.github/workflows/tox.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: tox 3 | 4 | on: 5 | create: # is used for publishing to PyPI and TestPyPI 6 | tags: # any tag regardless of its name, no branches 7 | - "**" 8 | push: # only publishes pushes to the main branch to TestPyPI 9 | branches: # any integration branch but not tag 10 | - "main" 11 | pull_request: 12 | release: 13 | types: 14 | - published # It seems that you can publish directly without creating 15 | 16 | concurrency: 17 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} 18 | cancel-in-progress: true 19 | 20 | jobs: 21 | linters: 22 | name: >- 23 | ${{ matrix.env.TOXENV }} 24 | runs-on: ${{ matrix.os }} 25 | strategy: 26 | fail-fast: false 27 | matrix: 28 | python-version: 29 | - "3.10" 30 | os: 31 | - ubuntu-20.04 32 | env: 33 | - TOXENV: lint 34 | env: 35 | TOX_PARALLEL_NO_SPINNER: 1 36 | FORCE_COLOR: 1 37 | 38 | steps: 39 | - name: Check out src from Git 40 | uses: actions/checkout@v3 41 | with: 42 | fetch-depth: 0 # needed by setuptools-scm 43 | 44 | - name: Set up Python ${{ matrix.python-version }} 45 | uses: actions/setup-python@v4 46 | with: 47 | python-version: ${{ matrix.python-version }} 48 | - name: Install tox 49 | run: | 50 | python3 -m pip install --upgrade pip 51 | python3 -m pip install --upgrade tox 52 | - name: Log installed dists 53 | run: >- 54 | python -m pip freeze --all 55 | - name: >- 56 | Initialize tox envs 57 | run: >- 58 | python -m 59 | tox 60 | --parallel auto 61 | --parallel-live 62 | --notest 63 | --skip-missing-interpreters false 64 | -vv 65 | env: ${{ matrix.env }} 66 | - name: Test with tox 67 | run: | 68 | python -m tox --parallel auto --parallel-live 69 | env: ${{ matrix.env }} 70 | - name: Archive logs 71 | uses: actions/upload-artifact@v3 72 | with: 73 | name: logs.zip 74 | path: .tox/**/log/ 75 | 76 | check: # This job does nothing and is only used for the branch protection 77 | if: always() 78 | 79 | needs: 80 | - linters 81 | 82 | runs-on: ubuntu-latest 83 | 84 | steps: 85 | - name: Decide whether the needed jobs succeeded or failed 86 | uses: re-actors/alls-green@release/v1 87 | with: 88 | jobs: ${{ toJSON(needs) }} 89 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | ci: 3 | # format compatible with commitlint 4 | autoupdate_commit_msg: "chore: pre-commit autoupdate" 5 | autoupdate_schedule: monthly 6 | autofix_commit_msg: | 7 | chore: auto fixes from pre-commit.com hooks 8 | 9 | for more information, see https://pre-commit.ci 10 | repos: 11 | - repo: https://github.com/pre-commit/mirrors-prettier 12 | # keep it before yamllint 13 | rev: v3.0.0 14 | hooks: 15 | - id: prettier 16 | additional_dependencies: 17 | - prettier 18 | - prettier-plugin-toml 19 | - repo: https://github.com/streetsidesoftware/cspell-cli 20 | rev: v6.31.0 21 | hooks: 22 | - id: cspell 23 | # entry: codespell --relative 24 | args: [--relative, --no-progress, --no-summary] 25 | name: Spell check with cspell 26 | - repo: https://github.com/sirosen/check-jsonschema 27 | rev: 0.23.2 28 | hooks: 29 | - id: check-github-workflows 30 | - repo: https://github.com/pre-commit/pre-commit-hooks.git 31 | rev: v4.4.0 32 | hooks: 33 | - id: end-of-file-fixer 34 | - id: trailing-whitespace 35 | - id: mixed-line-ending 36 | - id: fix-byte-order-marker 37 | - id: check-executables-have-shebangs 38 | - id: check-merge-conflict 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Notice 2 | 3 | This is unmaintained. Please use the current Github action here: https://github.com/marketplace/actions/run-ansible-lint 4 | 5 | 6 | # Ansible Lint for GitHub Action 7 | 8 | This action allows you to run `ansible-lint` on your codebase without having 9 | to install it yourself. 10 | 11 | ## Usage 12 | 13 | To use the action simply create an `ansible-lint.yml` (or choose custom `*.yml` name) in the `.github/workflows/` directory. 14 | 15 | For example: 16 | 17 | ```yaml 18 | name: ansible-lint 19 | on: [push, pull_request] 20 | 21 | jobs: 22 | build: 23 | name: Ansible Lint # Naming the build is important to use it as a status check 24 | runs-on: ubuntu-latest 25 | 26 | steps: 27 | # Important: This sets up your GITHUB_WORKSPACE environment variable 28 | - uses: actions/checkout@v3 29 | with: 30 | fetch-depth: 0 # needed for progressive mode to work 31 | 32 | - name: Run ansible-lint 33 | # replace `main` with any valid ref, or tags like `v6` 34 | uses: ansible/ansible-lint-action@main 35 | # optional: 36 | # with: 37 | # path: "playbooks/" # <-- only one value is allowed 38 | ``` 39 | 40 | Due to limitations on how GitHub Actions are processing arguments, we do not 41 | plan to provide extra options. You will have to make use of [ansible-lint own configuration file](https://ansible-lint.readthedocs.io/configuring/) 42 | for altering its behavior. 43 | 44 | If you still want custom arguments, you can still fork the action and modify 45 | its `action.yml` file. 46 | 47 | > TIP: N.B. Use `ansible/ansible-lint-action@v6` or any other valid tag, or branch, or commit SHA to pin the action to use a specific version. 48 | 49 | Alternatively, you can run the ansible lint only on certain branches: 50 | 51 | ```yaml 52 | on: 53 | push: 54 | branches: 55 | - stable 56 | - release/v* 57 | ``` 58 | 59 | or on various [events](https://help.github.com/en/articles/events-that-trigger-workflows) 60 | 61 |
62 | 63 | ## License 64 | 65 | The Dockerfile and associated scripts and documentation in this project are released under the [MIT](license). 66 | 67 | ## Credits 68 | 69 | The initial GitHub action has been created by [Stefan Stölzle](https://github.com/stoe) at 70 | [stoe/actions](https://github.com/stoe/actions). 71 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: Ansible Lint 2 | description: Run Ansible Lint 3 | author: Ansible by Red Hat 4 | branding: 5 | icon: shield 6 | color: red 7 | inputs: 8 | path: 9 | description: > 10 | Specific path to lint instead of the default `.`. Multiple arguments are 11 | not supported and you will need to alter linter configuration to 12 | accommodate other use cases. 13 | required: false 14 | # That default is just a placeholder workaround for no arguments use-case 15 | # Feeding "." or empty string to ansible-lint makes it believe it is a role 16 | default: --show-relpath 17 | args: 18 | description: deprecated 19 | deprecationMessage: > 20 | Arbitrary args are no longer accepted, please use path instead and 21 | linter own configuration file to change its behavior. 22 | required: false 23 | default: "" 24 | runs: 25 | using: docker 26 | image: docker://ghcr.io/ansible/creator-ee:v0.19.0 27 | entrypoint: /usr/local/bin/ansible-lint 28 | env: 29 | # These tell ansible-lint to use github compatible annotation format: 30 | GITHUB_ACTIONS: "true" 31 | GITHUB_WORKFLOW: "{{ github.workflow.name }}" 32 | args: 33 | - ${{ inputs.path }} 34 | -------------------------------------------------------------------------------- /cspell.config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dictionaryDefinitions: 3 | - name: words 4 | path: .config/dictionary.txt 5 | addWords: true 6 | dictionaries: 7 | # Use `cspell-cli trace word` to check where a work is defined 8 | - en_US 9 | - bash 10 | - words 11 | - python 12 | ignorePaths: 13 | - cspell.config.yaml 14 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2018‒2019 Stefan Stölzle, http://stefan.stoelzle.me 4 | Copyright (c) 2019 Ansible by Red Hat and contributors 5 | 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | # spell-checker:ignore linkcheck basepython changedir envdir envlist envname envsitepackagesdir passenv setenv testenv toxinidir toxworkdir usedevelop doctrees envpython posargs 2 | [tox] 3 | minversion = 4.0.16 4 | envlist = 5 | lint 6 | isolated_build = true 7 | skip_missing_interpreters = True 8 | 9 | [testenv] 10 | passenv = 11 | CURL_CA_BUNDLE # https proxies, https://github.com/tox-dev/tox/issues/1437 12 | FORCE_COLOR 13 | HOME 14 | LANG 15 | LC_ALL 16 | LC_CTYPE 17 | NO_COLOR 18 | PRE_COMMIT_HOME 19 | PYTEST_* # allows developer to define their own preferences 20 | PYTEST_REQPASS # needed for CI 21 | PY_COLORS 22 | REQUESTS_CA_BUNDLE # https proxies 23 | SSL_CERT_FILE # https proxies 24 | # recreate = True 25 | setenv = 26 | PIP_DISABLE_PIP_VERSION_CHECK = 1 27 | PRE_COMMIT_COLOR = always 28 | FORCE_COLOR = 1 29 | allowlist_externals = 30 | git 31 | sh 32 | # both options needed to workaround https://github.com/tox-dev/tox/issues/2197 33 | usedevelop = false 34 | skip_install = true 35 | 36 | [testenv:lint] 37 | description = Run all linters 38 | deps = 39 | pre-commit>=2.6.0 40 | skip_install = true 41 | commands = 42 | {envpython} -m pre_commit run --all-files --show-diff-on-failure {posargs:} 43 | setenv = 44 | {[testenv]setenv} 45 | # avoid messing pre-commit with out own constraints 46 | PIP_CONSTRAINT= 47 | --------------------------------------------------------------------------------