|
1 | 1 | # github-workflows |
2 | 2 | contains github workflows for the datavisyn organisation |
3 | 3 |
|
| 4 | +## Auto-Fix Linting Functionality |
| 5 | + |
| 6 | +The `build-node-python` action now supports automatic fixing of linting errors. When enabled, the action will: |
| 7 | + |
| 8 | +1. Run the normal linting process first |
| 9 | +2. If linting fails and auto-fix is enabled, attempt to fix errors using: |
| 10 | + - `yarn lint:fix` for frontend/Node.js projects |
| 11 | + - `make format` for backend/Python projects |
| 12 | +3. Re-run the linting process to verify fixes worked |
| 13 | +4. Commit and push changes if fixes were successful |
| 14 | + |
| 15 | +### Usage |
| 16 | + |
| 17 | +#### Via workflow_call |
| 18 | +```yaml |
| 19 | +jobs: |
| 20 | + build: |
| 21 | + uses: datavisyn/github-workflows/.github/workflows/build-node-python.yml@main |
| 22 | + with: |
| 23 | + auto_fix_lint: true # Enable auto-fix (default: false) |
| 24 | +``` |
| 25 | +
|
| 26 | +#### Via workflow_dispatch |
| 27 | +The `build-node-python.yml` workflow can now be manually triggered with: |
| 28 | +- `auto_fix_lint`: Enable automatic fixing of linting errors |
| 29 | +- Other standard parameters like `run_parallel`, `cypress_enable`, etc. |
| 30 | + |
| 31 | +#### Direct action usage |
| 32 | +```yaml |
| 33 | +- uses: datavisyn/github-workflows/.github/actions/build-node-python@main |
| 34 | + with: |
| 35 | + auto_fix_lint: true |
| 36 | + # ... other parameters |
| 37 | +``` |
| 38 | + |
| 39 | +### Requirements |
| 40 | + |
| 41 | +For auto-fix to work, your project should have: |
| 42 | +- `yarn lint:fix` command available (for Node.js projects) |
| 43 | +- `make format` target available (for Python projects) |
| 44 | +- Proper git permissions for the workflow to commit and push changes |
| 45 | + |
| 46 | +### Notes |
| 47 | + |
| 48 | +- Auto-fix is disabled by default to maintain backward compatibility |
| 49 | +- Fixed files are committed with message: "Auto-fix: Apply linting and formatting fixes [skip ci]" |
| 50 | +- If fixes don't resolve all linting issues, the workflow will still fail |
| 51 | +- The workflow requires `contents: write` permission to commit changes |
| 52 | + |
4 | 53 | ## Linting |
5 | 54 | We use super-linter from github (see <https://github.com/github/super-linter>) |
6 | 55 |
|
|
0 commit comments