Fix issue #5337: [Bug]: lint-fix workflow is failing frontend and python steps (#5338)

Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
This commit is contained in:
OpenHands 2024-11-30 19:18:13 -05:00 committed by GitHub
parent b156b237ec
commit 6ee9028d4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,9 +5,10 @@ on:
types: [labeled]
jobs:
lint-fix:
# Frontend lint fixes
lint-fix-frontend:
if: github.event.label.name == 'lint-fix'
name: Fix linting issues
name: Fix frontend linting issues
runs-on: ubuntu-latest
permissions:
contents: write
@ -20,7 +21,6 @@ jobs:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
# Frontend lint fixes
- name: Install Node.js 20
uses: actions/setup-node@v4
with:
@ -34,7 +34,36 @@ jobs:
cd frontend
npm run lint:fix
# Python lint fixes
# Commit and push changes if any
- name: Check for changes
id: git-check
run: |
git diff --quiet || echo "changes=true" >> $GITHUB_OUTPUT
- name: Commit and push if there are changes
if: steps.git-check.outputs.changes == 'true'
run: |
git config --local user.email "openhands@all-hands.dev"
git config --local user.name "OpenHands Bot"
git add -A
git commit -m "🤖 Auto-fix frontend linting issues"
git push
# Python lint fixes
lint-fix-python:
if: github.event.label.name == 'lint-fix'
name: Fix Python linting issues
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up python
uses: actions/setup-python@v5
with:
@ -58,5 +87,5 @@ jobs:
git config --local user.email "openhands@all-hands.dev"
git config --local user.name "OpenHands Bot"
git add -A
git commit -m "🤖 Auto-fix linting issues"
git commit -m "🤖 Auto-fix Python linting issues"
git push