forked from ansible/ansible-lint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
51 lines (47 loc) · 1.81 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
name: run-ansible-lint
description: Run Ansible Lint
author: Ansible by Red Hat <[email protected]>
branding:
icon: shield
color: red
inputs:
args:
description: Arguments to be passed to ansible-lint command
required: false
default: ""
runs:
using: composite
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # needed by setuptools-scm
submodules: true
# Due to GHA limitation, caching works only for files within GITHUB_WORKSPACE
# folder, so we are forced to stick this temporary file inside .git, so it
# will not affect the linted repository.
# https://github.com/actions/toolkit/issues/1035
# https://github.com/actions/setup-python/issues/361
- name: Generate .git/ansible-lint-requirements.txt
shell: bash
run: |
wget --output-file=.git/ansible-lint-requirements.txt https://raw.githubusercontent.com/ansible/ansible-lint/${{ github.action_ref || 'main' }}/.config/requirements-lock.txt
- name: Set up Python
uses: actions/setup-python@v4
with:
cache: pip
cache-dependency-path: .git/ansible-lint-requirements.txt
python-version: "3.11"
- name: Install ansible-lint
shell: bash
# We need to set the version manually because $GITHUB_ACTION_PATH is not
# a git clone and setuptools-scm would not be able to determine the version.
# git+https://github.com/ansible/ansible-lint@${{ github.action_ref || 'main' }}
# SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.action_ref || 'main' }}
run: |
cd $GITHUB_ACTION_PATH
pip install "ansible-lint[lock] @ git+https://github.com/ansible/ansible-lint@${{ github.action_ref || 'main' }}"
ansible-lint --version
- name: Run ansible-lint
shell: bash
run: ansible-lint ${{ inputs.args }}