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
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');
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
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
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+ });
0 commit comments