From 6ee9028d4aa2fc50eb00b7a9051e639df7c3613f Mon Sep 17 00:00:00 2001 From: OpenHands Date: Sat, 30 Nov 2024 19:18:13 -0500 Subject: [PATCH] Fix issue #5337: [Bug]: lint-fix workflow is failing frontend and python steps (#5338) Co-authored-by: Engel Nyst --- .github/workflows/lint-fix.yml | 39 +++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint-fix.yml b/.github/workflows/lint-fix.yml index 9fa97eaaf2..dca35010fb 100644 --- a/.github/workflows/lint-fix.yml +++ b/.github/workflows/lint-fix.yml @@ -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