diff --git a/.github/workflows/reusable-ci.yml b/.github/workflows/reusable-ci.yml index ca82a181837..860d7816eba 100644 --- a/.github/workflows/reusable-ci.yml +++ b/.github/workflows/reusable-ci.yml @@ -94,6 +94,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 0d343a7d1a3..4d066138f7e 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 97461939f94..60340038a09 100644 --- a/.github/workflows/reusable-pre-commit.yml +++ b/.github/workflows/reusable-pre-commit.yml @@ -64,6 +64,13 @@ jobs: java-version: "16" distribution: "temurin" cache: "maven" + - 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 @@ -71,8 +78,8 @@ jobs: wget https://github.com/google/google-java-format/releases/download/v1.16.0/google-java-format-1.16.0-all-deps.jar -O google-java-format.jar pre-commit run --verbose --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: |-