diff --git a/.github/workflows/reusable-ci.yml b/.github/workflows/reusable-ci.yml index 9f4a3feff75..a215ae0bb33 100644 --- a/.github/workflows/reusable-ci.yml +++ b/.github/workflows/reusable-ci.yml @@ -60,6 +60,7 @@ jobs: with: target-branch: ${{ inputs.target-branch }} cache-version: ${{ inputs.cache-version }} + 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 af6d5e6d021..4798a72bdae 100644 --- a/.github/workflows/reusable-integration-test.yml +++ b/.github/workflows/reusable-integration-test.yml @@ -43,6 +43,11 @@ on: required: false type: string default: '' + 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 @@ -70,7 +75,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 a5f80fd5e46..27bf9957a4f 100644 --- a/.github/workflows/reusable-pre-commit.yml +++ b/.github/workflows/reusable-pre-commit.yml @@ -56,14 +56,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 }} run: |-