-
Notifications
You must be signed in to change notification settings - Fork 1
Add auto-fix functionality for yarn lint:fix and make format in build-node-python workflow #193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: puehringer <51900829+puehringer@users.noreply.github.com>
Co-authored-by: puehringer <51900829+puehringer@users.noreply.github.com>
workflow_dispatch: | ||
inputs: | ||
branch: | ||
type: string | ||
required: false | ||
description: "Branch to build" | ||
default: "main" | ||
auto_fix_lint: | ||
description: "Automatically fix linting errors when possible and commit changes" | ||
type: boolean | ||
required: false | ||
default: false | ||
cypress_enable: | ||
description: "Global enable for cypress" | ||
type: boolean | ||
required: false | ||
default: false | ||
playwright_enable: | ||
description: "Global enable for playwright" | ||
type: boolean | ||
required: false | ||
default: false | ||
node_run_webpack: | ||
description: "Flag to always run the webpack production build." | ||
type: boolean | ||
required: false | ||
default: false | ||
run_parallel: | ||
description: "Flag to ensure that node and python jobs are run in parallel." | ||
type: boolean | ||
required: false | ||
default: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is never dispatched, just called. So it can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the workflow_dispatch section. You're absolutely right - this is a reusable workflow that's only called by other workflows, not manually dispatched. The auto_fix_lint parameter remains available in the workflow_call inputs. Changes in commit 53a2368.
Co-authored-by: puehringer <51900829+puehringer@users.noreply.github.com>
echo "No staged changes to commit" | ||
return 0 | ||
fi | ||
git commit -m "Auto-fix: Apply linting and formatting fixes [skip ci]" || true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to skip the CI at this point, as things may still break (an infinite loop should not happen as we don't commit if no changes are made, right?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed [skip ci]
from the commit message to allow CI validation. The commit message is now just "Auto-fix: Apply linting and formatting fixes" which will trigger CI as expected. You're right about the infinite loop protection - we only commit when there are actual staged changes. Changes in commit 97d745e.
Co-authored-by: puehringer <51900829+puehringer@users.noreply.github.com>
This PR adds automatic linting error fixing capability to the
build-node-python
action and workflow, allowing developers to automatically fix linting issues via workflow_dispatch.Changes Made
🎯 Core Functionality
auto_fix_lint
input (default:false
) to maintain backward compatibilityyarn lint:fix
for frontend andmake format
for backend projects🚀 Workflow Dispatch Support
workflow_dispatch
trigger tobuild-node-python.yml
workflowauto_fix_lint
,cypress_enable
,playwright_enable
, etc.🔧 Integration
auto_fix_lint
parameter:build-node
jobbuild-python
jobbuild-node-python-cypress
jobbuild-node-python-playwright
jobUsage Examples
Via workflow_call:
Via workflow_dispatch:
Manually trigger the workflow from GitHub Actions tab with auto-fix enabled.
Direct action usage:
How It Works
auto_fix_lint: true
, attempts to fix errorsyarn lint:fix
(Node.js) and/ormake format
(Python)Backward Compatibility
✅ Fully backward compatible: All existing workflows continue to work without modification since
auto_fix_lint
defaults tofalse
.Requirements
For auto-fix to work, projects should have:
yarn lint:fix
command available (Node.js projects)make format
target available (Python projects)contents: write
permission for commitsTesting
Fixes #192.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.