diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 26c1274b..ecceefe1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,6 +10,7 @@ on: - main - develop merge_group: + workflow_call: concurrency: group: (${{ github.workflow }}-${{ github.event.inputs.branch || github.event.pull_request.head.ref }}) diff --git a/.github/workflows/pre-commit-autoupdate.yml b/.github/workflows/pre-commit-autoupdate.yml index a08844b3..4634c6ee 100644 --- a/.github/workflows/pre-commit-autoupdate.yml +++ b/.github/workflows/pre-commit-autoupdate.yml @@ -10,14 +10,40 @@ on: jobs: auto-update: runs-on: ubuntu-latest + outputs: + diff: ${{ steps.check-diff.outputs.diff }} steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 - uses: browniebroke/pre-commit-autoupdate-action@main - uses: peter-evans/create-pull-request@v6 + id: pr-create with: token: ${{ secrets.GITHUB_TOKEN }} branch: update/pre-commit-hooks title: Update pre-commit hooks commit-message: "chore: update pre-commit hooks" body: Update versions of pre-commit hooks to latest version. + - name: Set outputs + id: check-diff + if: | + (steps.pr-create.outputs.pull-request-operation == 'created' || + steps.pr-create.outputs.pull-request-operation == 'updated') && + steps.pr-create.outputs.pull-request-number + run: | + echo "diff=true" >> "$GITHUB_OUTPUT" + echo "PR status: ${{ steps.pr-create.outputs.pull-request-operation }}" + echo "PR number: ${{ steps.pr-create.outputs.pull-request-number }}" + echo "Running workflows for ${{ steps.pr-create.outputs.pull-request-url }}" + + lint-workflow: + name: Run lint + needs: auto-update + if: ${{ needs.auto-update.outputs.diff }} + uses: ./.github/workflows/lint.yml + + test-workflow: + name: run tests on diff + needs: auto-update + if: ${{ needs.auto-update.outputs.diff }} + uses: ./.github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a3173b81..92427e6b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,7 @@ on: - develop - "[0-9]+.[0-9]+.x" merge_group: + workflow_call: concurrency: group: ${{ github.workflow }}-${{ github.ref }}