Skip to content

Commit 227f6b0

Browse files
authored
fix: Fixed entrypoint of the action Docker (#6)
* feat: Improved script * fix: Fixed action wrapping * docs: Updated documentation * fix: Fixed entrypoint * refactor: Moved python files to src/ * ci: Added build and test workflows * docs: Added README badges * chore: Updated Dockerfile * style: Updated style configs
1 parent f9df693 commit 227f6b0

8 files changed

Lines changed: 70 additions & 5 deletions

File tree

.github/workflows/builds.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: builds
2+
3+
on:
4+
push:
5+
branches: main
6+
pull_request:
7+
branches: main
8+
9+
jobs:
10+
build:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest]
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Cache python modules
19+
uses: satackey/action-docker-layer-caching@v0.0.11
20+
# Ignore the failure of a step and avoid terminating the job.
21+
continue-on-error: true
22+
- name: Build docker
23+
run: docker build . -t header-validator:py3.8.13-alpine

.github/workflows/tests.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches: main
6+
pull_request:
7+
branches: main
8+
9+
jobs:
10+
run-action:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest]
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Cache python modules
19+
uses: satackey/action-docker-layer-caching@v0.0.11
20+
# Ignore the failure of a step and avoid terminating the job.
21+
continue-on-error: true
22+
- name: Build docker
23+
run: docker build . -t header-validator:py3.8.13-alpine
24+
- name: Run action
25+
run: docker run header-validator:py3.8.13-alpine Apache-2.0 'François-Guillaume Fernandez' 2022 src/ __init__.py

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
FROM python:3.8.13-alpine
22

3+
ENV PYTHONDONTWRITEBYTECODE 1
4+
ENV PYTHONUNBUFFERED 1
5+
36
COPY entrypoint.sh /entrypoint.sh
4-
COPY validate_headers.py /validate_headers.py
5-
COPY supported-licenses.json /supported-licenses.json
7+
COPY src/validate_headers.py /validate_headers.py
8+
COPY src/supported-licenses.json /supported-licenses.json
69

710
ENTRYPOINT ["/entrypoint.sh"]

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Header validator for your Python files
22

3+
<p align="center">
4+
<a href="https://github.com/frgfm/validate-python-headers/actions?query=workflow%3Abuilds">
5+
<img alt="CI Status" src="https://img.shields.io/github/workflow/status/frgfm/validate-python-headers/builds?label=CI&logo=github&style=flat-square">
6+
</a>
7+
<a href="https://github.com/ambv/black">
8+
<img src="https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square" alt="black">
9+
</a>
10+
<a href="https://www.codacy.com/gh/frgfm/validate-python-headers/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=frgfm/validate-python-headers&amp;utm_campaign=Badge_Grade"><img src="https://app.codacy.com/project/badge/Grade/4e50e872d9fd4a378b696bdc0aea9301"/></a>
11+
<p align="center">
12+
<img alt="GitHub release (latest by date)" src="https://img.shields.io/github/v/release/frgfm/validate-python-headers">
13+
<img alt="GitHub" src="https://img.shields.io/github/license/frgfm/validate-python-headers">
14+
</p>
15+
16+
317
This action checks the copyright and license notices in the headers of your Python files.
418

519
## Inputs

entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh -l
22
set -eax
33

4-
python /validate_headers.py $1 $2 $3 --folders $4 --ignores $5
4+
python /validate_headers.py "${1}" "${2}" $3 --folders $4 --ignores $5

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tool.mypy]
2-
files = "*.py"
2+
files = "src/*.py"
33
show_error_codes = true
44
pretty = true
55
warn_unused_ignores = true
@@ -11,7 +11,7 @@ implicit_reexport = false
1111
[tool.isort]
1212
profile = "black"
1313
line_length = 120
14-
src_paths = ["."]
14+
src_paths = ["src"]
1515
skip_glob = "**/__init__.py"
1616
known_third_party = []
1717

0 commit comments

Comments
 (0)