Skip to content

Commit 6c64520

Browse files
committed
ci:change workflow trigger on pull requests only
1 parent 6a01db2 commit 6c64520

3 files changed

Lines changed: 55 additions & 31 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/learn-github-actions.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Lint (Python, Ansible, Docker, Kubernetes)
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
# Python linting (flake8)
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.11"
20+
21+
- name: Install Python linters
22+
run: |
23+
pip install flake8
24+
25+
- name: Run flake8
26+
run: flake8 .
27+
28+
# Ansible linting
29+
- name: Install ansible-lint
30+
run: |
31+
pip install ansible ansible-lint
32+
33+
- name: Run ansible-lint
34+
run: ansible-lint .
35+
36+
# Dockerfile linting (hadolint)
37+
- name: Install hadolint
38+
run: |
39+
sudo wget -qO /usr/local/bin/hadolint https://github.com/hadolint/hadolint/releases/latest/download/hadolint-Linux-x86_64
40+
sudo chmod +x /usr/local/bin/hadolint
41+
42+
- name: Run hadolint
43+
run: |
44+
find . -type f -iname "Dockerfile*" -exec hadolint {} \; || true
45+
46+
# Kubernetes manifest linting (kubeval)
47+
- name: Install kubeval
48+
run: |
49+
wget -q https://github.com/instrumenta/kubeval/releases/latest/download/kubeval-linux-amd64.tar.gz
50+
tar xf kubeval-linux-amd64.tar.gz
51+
sudo mv kubeval /usr/local/bin/
52+
53+
- name: Run kubeval
54+
run: |
55+
find k8s -name "*.yaml" -o -name "*.yml" -exec kubeval {} \; || true

0 commit comments

Comments
 (0)