From d37a4790156f7ef7681926b9c737075e5b65ae88 Mon Sep 17 00:00:00 2001 From: daz Date: Wed, 10 Apr 2024 16:21:22 -0600 Subject: [PATCH] Use pull_request triggers primarily for workflows Instead of relying on push triggers in general, we now use pull_request and reserve push triggers for main and release branches. This makes the behaviour more consistent for users contributing from repository forks. However, we no longer have a quick-feedback loop for development. --- .github/workflows/ci-check-and-unit-test.yml | 4 +++ .github/workflows/ci-check-no-dist-update.yml | 5 +--- .github/workflows/ci-codeql.yml | 2 -- .github/workflows/ci-init-script-check.yml | 4 +++ .github/workflows/ci-integ-test.yml | 29 +++++++++---------- .github/workflows/ci-update-dist.yml | 4 +-- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci-check-and-unit-test.yml b/.github/workflows/ci-check-and-unit-test.yml index 96a7def..24b6dd5 100644 --- a/.github/workflows/ci-check-and-unit-test.yml +++ b/.github/workflows/ci-check-and-unit-test.yml @@ -2,6 +2,10 @@ name: CI-check-and-unit-test on: push: + branches: + - 'main' + - 'release/**' + pull_request: permissions: contents: read diff --git a/.github/workflows/ci-check-no-dist-update.yml b/.github/workflows/ci-check-no-dist-update.yml index 515cb17..f48a095 100644 --- a/.github/workflows/ci-check-no-dist-update.yml +++ b/.github/workflows/ci-check-no-dist-update.yml @@ -3,10 +3,7 @@ name: CI-check-no-dist-update # Prohibit any change to 'dist/**' on a non-release branch on: workflow_dispatch: - push: - branches-ignore: - - 'main' - - 'release/**' + pull_request: paths: - 'dist/**' diff --git a/.github/workflows/ci-codeql.yml b/.github/workflows/ci-codeql.yml index fceeee6..4d60351 100644 --- a/.github/workflows/ci-codeql.yml +++ b/.github/workflows/ci-codeql.yml @@ -3,8 +3,6 @@ name: CI-codeql on: push: branches: [ "main" ] - pull_request: - branches: [ "main" ] schedule: - cron: '25 23 * * 2' diff --git a/.github/workflows/ci-init-script-check.yml b/.github/workflows/ci-init-script-check.yml index 454ab0b..9446671 100644 --- a/.github/workflows/ci-init-script-check.yml +++ b/.github/workflows/ci-init-script-check.yml @@ -2,6 +2,10 @@ name: CI-init-script-check on: push: + branches: + - 'main' + - 'release/**' + pull_request: paths: - '.github/workflows/ci-init-script-check.yml' - 'sources/src/resources/init-scripts/**' diff --git a/.github/workflows/ci-integ-test.yml b/.github/workflows/ci-integ-test.yml index 748a4fd..50d5f97 100644 --- a/.github/workflows/ci-integ-test.yml +++ b/.github/workflows/ci-integ-test.yml @@ -2,7 +2,12 @@ name: CI-integ-test on: workflow_dispatch: + pull_request: push: + branches: + - 'main' + - 'release/**' + - 'dev/**' # Allow running tests on dev branches without a PR jobs: determine-suite: @@ -11,35 +16,27 @@ jobs: runner-os: ${{ steps.determine-suite.outputs.suite == 'quick' && '["ubuntu-latest"]' || '["ubuntu-latest", "windows-latest", "macos-latest"]' }} cache-key-prefix: ${{ steps.determine-suite.outputs.suite == 'quick' && '0' || github.run_number }} steps: - - name: Get current PR details - uses: 8BitJonny/gh-get-current-pr@3.0.0 - id: PR - name: Determine suite to run id: determine-suite run: | # Always run quick suite if we are not in the core `gradle/actions` repository - # This reduces the load for developers working on forks + # This reduces the load for developers working on 'main' on forks if [ "${{ github.repository }}" != "gradle/actions" ]; then echo "Not in core repository: suite=quick" echo "suite=quick" >> "$GITHUB_OUTPUT" exit 0 fi - # Always run quick suite for dependabot PRs - if [ "${{ github.actor }}" == "dependabot[bot]" ]; then - echo "Dependabot: suite=quick" - echo "suite=quick" >> "$GITHUB_OUTPUT" + # Run full suite for push trigger on 'main' and 'release/*' branches + if [[ "${{ github.ref_name }}" == "main" || "${{ github.ref_name }}" == "release/"* ]]; then + echo "Push to main branch: suite=full" + echo "suite=full" >> "$GITHUB_OUTPUT" exit 0 fi - # Run full suite for PRs - if [ "${{ steps.PR.outputs.pr_found }}" == "false" ]; then - echo "PR not found: suite=quick" - echo "suite=quick" >> "$GITHUB_OUTPUT" - else - echo "PR found: suite=full" - echo "suite=full" >> "$GITHUB_OUTPUT" - fi + # Run quick suite for everything else + echo "Everything else: suite=quick" + echo "suite=quick" >> "$GITHUB_OUTPUT" build-distribution: runs-on: ubuntu-latest diff --git a/.github/workflows/ci-update-dist.yml b/.github/workflows/ci-update-dist.yml index 5b42a4a..fee1f5b 100644 --- a/.github/workflows/ci-update-dist.yml +++ b/.github/workflows/ci-update-dist.yml @@ -4,8 +4,8 @@ on: workflow_dispatch: push: branches: - - 'main' - - 'release/**' + - 'main' + - 'release/**' permissions: contents: write