Skip to content

Commit

Permalink
ci: use custom pylint job instead of actions
Browse files Browse the repository at this point in the history
build: update dockerfile
  • Loading branch information
Nicconike committed Jul 1, 2024
1 parent b958eea commit ad37826
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 18 deletions.
54 changes: 38 additions & 16 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,26 +73,48 @@ jobs:
restore-keys: |
${{ runner.os }}-pip-
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Run Pylint
id: run-pylint
run: |
pylint api tests > pylint-report.txt || true
- name: GitHub App Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.APP_CLIENT_ID }}
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Pylint Scan & Badge
uses: Silleellie/pylint-github-action@v2
with:
lint-path: |
api
tests
python-version: 3.12
requirements-path: requirements.txt
readme-path: README.md
badge-text: Pylint
color-bad-score: red
color-ok-score: orange
color-good-score: yellow
color-perfect-score: brightgreen
- name: Generate Pylint Badge
id: generate-badge
run: |
score=$(tail -n 1 pylint-report.txt | grep -oP '\d+\.\d+')
if [ -z "$score" ]; then
score="0.0"
fi
color="red"
if (( $(echo "$score >= 9" | bc -l) )); then
color="brightgreen"
elif (( $(echo "$score >= 7" | bc -l) )); then
color="yellow"
elif (( $(echo "$score >= 5" | bc -l) )); then
color="orange"
fi
badge="![pylint](https://img.shields.io/badge/linting-pylint-$score-$color)"
sed -i 's|!\[pylint\](.*)|'"$badge"'|' README.md
- name: Commit and Push Changes
if: github.ref == 'refs/heads/master'
env:
github_token: ${{ steps.app-token.outputs.token }}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
git config --global user.email "action@github.com"
git config --global user.name "GitHub Action"
git add README.md
git commit -m "Update Pylint Badge"
git push
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.APP_CLIENT_ID }}
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Checkout Code
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN apt-get update && \
apt-get install -y --no-install-recommends git && \
pip install --no-cache-dir -r /steam-stats/requirements.txt && \
apt-get purge -y --auto-remove && \
playwright uninstall chromium webkit && \
playwright uninstall chromium && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

Expand Down

0 comments on commit ad37826

Please sign in to comment.