diff --git a/.github/workflows/reusable-ci.yml b/.github/workflows/reusable-ci.yml index 7c25f5c71d55..18fc8f8da400 100644 --- a/.github/workflows/reusable-ci.yml +++ b/.github/workflows/reusable-ci.yml @@ -81,6 +81,7 @@ jobs: uses: ./.github/workflows/reusable-integration-test.yml with: target-branch: ${{ inputs.target-branch }} + has-integration-label: ${{ contains(github.event.pull_request.labels.*.name, 'ci/integrations') }} secrets: PIPELINE_GITHUB_APP_ID: ${{ secrets.PIPELINE_GITHUB_APP_ID }} PIPELINE_GITHUB_APP_PRIVATE_KEY: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }} diff --git a/.github/workflows/reusable-integration-test.yml b/.github/workflows/reusable-integration-test.yml index c07c551ccd05..e558cd82ec11 100644 --- a/.github/workflows/reusable-integration-test.yml +++ b/.github/workflows/reusable-integration-test.yml @@ -38,6 +38,11 @@ on: required: false type: string default: 'datadog-api-spec' + has-integration-label: + description: 'Whether the calling PR has ci/integrations label' + required: false + type: boolean + default: false secrets: PIPELINE_GITHUB_APP_ID: required: false @@ -65,7 +70,8 @@ jobs: !contains(github.event.pull_request.labels.*.name, 'ci/skip') && !contains(github.event.pull_request.head.ref, 'datadog-api-spec/test/') && contains(github.event.pull_request.labels.*.name, 'ci/integrations')) || - github.event_name == 'schedule' + github.event_name == 'schedule' || + (github.event_name == 'workflow_call' && inputs.has-integration-label) services: datadog-agent: image: gcr.io/datadoghq/agent:latest diff --git a/.github/workflows/reusable-pre-commit.yml b/.github/workflows/reusable-pre-commit.yml index 42368bef9a28..02d799e1c00d 100644 --- a/.github/workflows/reusable-pre-commit.yml +++ b/.github/workflows/reusable-pre-commit.yml @@ -58,14 +58,21 @@ jobs: with: path: ~/.cache/pre-commit key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} + - name: Determine pre-commit range + id: commit_range + run: | + FROM_REF=$(git merge-base HEAD origin/master) + echo "from_ref=$FROM_REF" >> $GITHUB_OUTPUT + echo "to_ref=HEAD" >> $GITHUB_OUTPUT + echo "Pre-commit will check from $FROM_REF to HEAD" - id: pre_commit name: Run pre-commit if: github.event.action != 'closed' && github.event.pull_request.merged != true run: | pre-commit run --from-ref "${FROM_REF}" --to-ref "${TO_REF}" --show-diff-on-failure --color=always env: - FROM_REF: ${{ github.event.pull_request.base.sha }} - TO_REF: ${{ github.event.pull_request.head.sha }} + FROM_REF: ${{ steps.commit_range.outputs.from_ref }} + TO_REF: ${{ steps.commit_range.outputs.to_ref }} - name: Commit changes if: failure() && inputs.enable-commit-changes && github.event.pull_request.head.repo.full_name == github.repository run: |-