Skip to content

Commit 521f996

Browse files
authored
chore: Limit --progress=plain to CI (#354)
With this change `make build` on a local dev machine uses tty formatting, with colors and redrawing.
1 parent cf60927 commit 521f996

3 files changed

Lines changed: 37 additions & 30 deletions

File tree

.github/workflows/auto-fix-linting.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ jobs:
99
# Only run on pull request comments with the trigger phrase
1010
if: github.event.issue.pull_request && contains(github.event.comment.body, '/fix-linting')
1111
runs-on: ubuntu-latest
12-
12+
1313
permissions:
1414
contents: write
1515
pull-requests: write
16-
16+
17+
env:
18+
COMPOSE_PROGRESS: plain
19+
1720
steps:
1821
- name: Check user permissions
1922
id: permission
@@ -25,7 +28,7 @@ jobs:
2528
repo: context.repo.repo,
2629
username: context.payload.comment.user.login,
2730
});
28-
31+
2932
const hasPermission = ['admin', 'write'].includes(collaboration.permission);
3033
if (!hasPermission) {
3134
core.setFailed('User does not have write permissions to trigger linting fixes');
@@ -57,8 +60,8 @@ jobs:
5760
- name: Set up Python
5861
uses: actions/setup-python@v5
5962
with:
60-
python-version: '3.11'
61-
63+
python-version: "3.11"
64+
6265
- name: Install pre-commit and linting tools
6366
run: |
6467
pip install pre-commit black flake8 isort mypy
@@ -80,7 +83,7 @@ jobs:
8083
run: |
8184
# Run black to fix Python formatting
8285
black app/ tests/ --line-length=88 || true
83-
# Run isort to fix import ordering
86+
# Run isort to fix import ordering
8487
isort app/ tests/ --profile black || true
8588
continue-on-error: true
8689

@@ -95,7 +98,7 @@ jobs:
9598
run: |
9699
git config --global user.name 'github-actions[bot]'
97100
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
98-
101+
99102
if [[ $(git status --porcelain) ]]; then
100103
echo "changes=true" >> $GITHUB_OUTPUT
101104
echo "Found changes to commit"
@@ -111,7 +114,7 @@ jobs:
111114
git commit -m "Auto-fix linting issues
112115
113116
Triggered by comment from @${{ github.event.comment.user.login }}
114-
117+
115118
Co-authored-by: ${{ github.event.comment.user.login }} <${{ github.event.comment.user.login }}@users.noreply.github.com>"
116119
git push
117120
@@ -120,13 +123,13 @@ jobs:
120123
with:
121124
script: |
122125
const changes = '${{ steps.changes.outputs.changes }}';
123-
const message = changes === 'true'
126+
const message = changes === 'true'
124127
? '✅ Linting issues have been automatically fixed and committed to this PR!'
125128
: '✅ No linting issues found that could be automatically fixed.';
126-
129+
127130
github.rest.issues.createComment({
128131
issue_number: context.issue.number,
129132
owner: context.repo.owner,
130133
repo: context.repo.repo,
131134
body: message
132-
});
135+
});

.github/workflows/pre-commit.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,30 @@ name: Run checks
22

33
on:
44
pull_request:
5-
branches: [ main ]
5+
branches: [main]
66

77
jobs:
88
checks:
99
runs-on: ubuntu-latest
10+
11+
env:
12+
COMPOSE_PROGRESS: plain
13+
1014
steps:
11-
- uses: actions/checkout@v6
12-
- name: install python
13-
uses: actions/setup-python@v5
14-
with:
15-
python-version: 3.11
16-
- name: build docker containers
17-
run: |
18-
echo "" > .envrc
19-
echo CONFIG_PATH=data/config/openfoodfacts.yml >> .envrc
20-
echo OFF_API_URL=https://world.openfoodfacts.org >> .envrc
21-
echo USER_IID=$(id -u) >>.envrc
22-
echo USER_GID=$(id -g) >>.envrc
23-
make build
24-
- name: Enforce pre-commit hook server side
25-
uses: pre-commit/action@v3.0.1
26-
- name: run tests
27-
run: make test
15+
- uses: actions/checkout@v6
16+
- name: install python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: 3.11
20+
- name: build docker containers
21+
run: |
22+
echo "" > .envrc
23+
echo CONFIG_PATH=data/config/openfoodfacts.yml >> .envrc
24+
echo OFF_API_URL=https://world.openfoodfacts.org >> .envrc
25+
echo USER_IID=$(id -u) >>.envrc
26+
echo USER_GID=$(id -g) >>.envrc
27+
make build
28+
- name: Enforce pre-commit hook server side
29+
uses: pre-commit/action@v3.0.1
30+
- name: run tests
31+
run: make test

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ livecheck:
5959

6060
build:
6161
@echo "🔎 building docker (for dev)"
62-
${DOCKER_COMPOSE} build --progress=plain ${args}
62+
${DOCKER_COMPOSE} build ${args}
6363

6464

6565
up: _ensure_network

0 commit comments

Comments
 (0)