diff --git a/.github/workflows/check-all-lint-rule-diffs.yaml b/.github/workflows/check-all-lint-rule-diffs.yaml index 126f65a..b8ddb35 100644 --- a/.github/workflows/check-all-lint-rule-diffs.yaml +++ b/.github/workflows/check-all-lint-rule-diffs.yaml @@ -13,7 +13,7 @@ jobs: name: Check diff runs-on: ubuntu-latest outputs: - diff_count: ${{ steps.output.outputs.diff_count }} + has_diff: ${{ steps.output.outputs.has_diff }} steps: - uses: actions/checkout@v4 - name: Set up Go @@ -26,34 +26,32 @@ jobs: run: go run main.go - name: output diff id: output - run: echo "diff_count=$(git diff --name-only --relative=packages/altive_lints/lib | wc -l)" >> "$GITHUB_OUTPUT" - - commit: - name: Commit diff - runs-on: ubuntu-latest - needs: [diff] - if: ${{ needs.diff.outputs.diff_count != '0' }} - steps: - - uses: actions/checkout@v4 + run: echo "diff_count=$(git diff --name-only --relative=packages/altive_lints/lib | wc -l)" >> "$GITHUB_ENV" - name: Create branch + if: env.diff_count != '0' run: | git switch -c ${{ env.branch }} git push origin ${{ env.branch }} - name: Git config + if: env.diff_count != '0' run: | git remote set-url origin https://github-actions:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY} git config --global user.name "${GITHUB_ACTOR}" git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" - name: Commit & Push + if: env.diff_count != '0' run: | git add . git commit -m "feat: update all_lint_rules" git push origin ${{ env.branch }} + - name: Output flag + run: echo "has_diff=${{ env.diff_count != '0' }}" >> "$GITHUB_OUTPUT" pull-request: name: Create Pull-Request runs-on: ubuntu-latest - needs: [commit] + needs: [diff] + if: needs.diff.outputs.has_diff == 'true' steps: - uses: actions/checkout@v4 - name: Generate GiHub App token