diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da7036d92f..b22958405d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,7 @@ jobs: metadata: name: Retrieve PR info runs-on: ubuntu-latest + if: ${{ github.event_name == 'workflow_dispatch' || ! github.event.repository.fork }} permissions: pull-requests: read diff --git a/.github/workflows/cla_assistant.yml b/.github/workflows/cla_assistant.yml index 9ca003c520..015835917d 100644 --- a/.github/workflows/cla_assistant.yml +++ b/.github/workflows/cla_assistant.yml @@ -9,6 +9,7 @@ name: "CLA bot" jobs: cla-acknowledgement: runs-on: ubuntu-latest + if: ${{ ! github.event.repository.fork }} name: "Check that the CLA has been acknowledged" steps: - name: "CLA Assistant" diff --git a/.github/workflows/clean_caches.yml b/.github/workflows/clean_caches.yml index 6c39d66608..3e9ba3dd2f 100644 --- a/.github/workflows/clean_caches.yml +++ b/.github/workflows/clean_caches.yml @@ -30,7 +30,7 @@ name: Clean GitHub caches jobs: automatic_cleanup: name: Clean up GitHub caches produced by other workflows - if: github.event_name == 'workflow_run' + if: (${{ github.event_name == 'workflow_dispatch' || ! github.event.repository.fork }} && github.event_name == 'workflow_run') permissions: write-all runs-on: ubuntu-latest @@ -68,7 +68,7 @@ jobs: selective_cleanup: name: Clean up selective GitHub caches - if: (github.event_name == 'workflow_dispatch' && inputs.cache_keys != '' ) + if: (${{ ! github.event.repository.fork }} && github.event_name == 'workflow_dispatch' && inputs.cache_keys != '' ) runs-on: ubuntu-latest permissions: write-all @@ -84,7 +84,7 @@ jobs: tar_cleanup: name: Clean up Github caches with tar archives - if: (github.event_name == 'workflow_dispatch' && inputs.cache_type == 'tar' ) + if: (${{ ! github.event.repository.fork }} && github.event_name == 'workflow_dispatch' && inputs.cache_type == 'tar' ) runs-on: ubuntu-latest permissions: write-all @@ -101,7 +101,7 @@ jobs: branch_cleanup: name: Clean up branch specific caches - if: (github.event_name == 'workflow_dispatch' && inputs.cache_type == 'branch' ) || (github.event_name == 'delete' && github.event.ref_type == 'branch') + if: (${{ ! github.event.repository.fork }} && ((github.event_name == 'workflow_dispatch' && inputs.cache_type == 'branch') || (github.event_name == 'delete' && github.event.ref_type == 'branch'))) runs-on: ubuntu-latest permissions: write-all @@ -138,7 +138,7 @@ jobs: pr_cleanup: name: Clean up PR related GitHub caches - if: github.event_name == 'pull_request_target' + if: (${{ ! github.event.repository.fork }} && github.event_name == 'pull_request_target') runs-on: ubuntu-latest permissions: write-all diff --git a/.github/workflows/clean_up.yml b/.github/workflows/clean_up.yml index 1d154c9f28..bd1eb0009b 100644 --- a/.github/workflows/clean_up.yml +++ b/.github/workflows/clean_up.yml @@ -22,7 +22,7 @@ name: Clean up jobs: bot_branches: name: Delete temporary bot/* branches - if: github.event_name == 'workflow_dispatch' && inputs.delete_temp_branches + if: (${{ ! github.event.repository.fork }} && github.event_name == 'workflow_dispatch' && inputs.delete_temp_branches) runs-on: ubuntu-latest steps: @@ -46,7 +46,7 @@ jobs: draft_releases: name: Delete draft release - if: github.event_name == 'workflow_dispatch' && inputs.delete_draft_releases + if: (${{ ! github.event.repository.fork }} && github.event_name == 'workflow_dispatch' && inputs.delete_draft_releases) runs-on: ubuntu-latest steps: @@ -67,6 +67,7 @@ jobs: ghcr_images: name: Clean up GHCR images + if: ${{ ! github.event.repository.fork }} runs-on: ubuntu-latest strategy: @@ -146,6 +147,7 @@ jobs: # See also https://github.com/actions/runner/issues/2120 deployments: name: Deployments + if: ${{ ! github.event.repository.fork }} runs-on: ubuntu-latest permissions: deployments: write @@ -177,7 +179,7 @@ jobs: pr_cleanup: name: Clean up documentation previews - if: github.event_name == 'pull_request_target' + if: (${{ ! github.event.repository.fork }} && github.event_name == 'pull_request_target') runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/command_dispatch.yml b/.github/workflows/command_dispatch.yml index 15a7952334..3737803dea 100644 --- a/.github/workflows/command_dispatch.yml +++ b/.github/workflows/command_dispatch.yml @@ -7,6 +7,7 @@ name: Slash command dispatch jobs: preprocessing: name: Check for slash command + if: ${{ ! github.event.repository.fork }} runs-on: ubuntu-latest permissions: # keep this limited to read permissions for the content only! diff --git a/.github/workflows/create_cache_command.yml b/.github/workflows/create_cache_command.yml index 5a129f4006..86fb9bb948 100644 --- a/.github/workflows/create_cache_command.yml +++ b/.github/workflows/create_cache_command.yml @@ -15,6 +15,7 @@ name: Create CI cache jobs: pr_info: name: Determine PR info + if: ${{ github.event_name == 'workflow_dispatch' || ! github.event.repository.fork }} runs-on: ubuntu-latest outputs: diff --git a/.github/workflows/delete_tags.yml b/.github/workflows/delete_tags.yml index 9ffe3401b6..11138b9f21 100644 --- a/.github/workflows/delete_tags.yml +++ b/.github/workflows/delete_tags.yml @@ -15,6 +15,7 @@ name: Delete tags jobs: ghcr_images: name: Clean up GHCR image tags + if: ${{ github.event_name == 'workflow_dispatch' || ! github.event.repository.fork }} runs-on: ubuntu-latest steps: diff --git a/.github/workflows/deployments.yml b/.github/workflows/deployments.yml index c9b7faa995..9a413d1209 100644 --- a/.github/workflows/deployments.yml +++ b/.github/workflows/deployments.yml @@ -52,7 +52,7 @@ concurrency: jobs: metadata: name: Prepare build - if: github.event_name != 'push' || github.event.created + if: (${{ ! github.event.repository.fork }} && (github.event_name != 'push' || github.event.created)) runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/dev_environment.yml b/.github/workflows/dev_environment.yml index 62ed0602c0..d91e1fd172 100644 --- a/.github/workflows/dev_environment.yml +++ b/.github/workflows/dev_environment.yml @@ -84,6 +84,7 @@ name: CUDA Quantum cached dev images jobs: metadata: name: Metadata + if: ${{ ! github.event.repository.fork }} runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/docker_images.yml b/.github/workflows/docker_images.yml index 9295a6d182..aef7293c30 100644 --- a/.github/workflows/docker_images.yml +++ b/.github/workflows/docker_images.yml @@ -37,6 +37,7 @@ name: Docker images jobs: metadata: name: Metadata + if: ${{ ! github.event.repository.fork }} runs-on: ubuntu-latest permissions: {} diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index b9dcf23a53..efd419c485 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -26,7 +26,7 @@ jobs: publish_docs: name: Publish documentation runs-on: ubuntu-latest - if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.name == 'CI' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.actor.id == '135836288') + if: (${{ github.event_name == 'workflow_dispatch' || ! github.event.repository.fork }} && (github.event_name == 'workflow_dispatch' || github.event.workflow_run.name == 'CI' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.actor.id == '135836288'))) permissions: contents: write diff --git a/.github/workflows/gh_registry.yml b/.github/workflows/gh_registry.yml index da51650fbf..b7d65a8fb5 100644 --- a/.github/workflows/gh_registry.yml +++ b/.github/workflows/gh_registry.yml @@ -8,7 +8,7 @@ name: Update GHCR jobs: ghcr_config: name: Read GHCR config - if: github.event_name == 'workflow_dispatch' || vars.enabled_workflows == 'all' + if: (${{ github.event_name == 'workflow_dispatch' || ! github.event.repository.fork }} && (github.event_name == 'workflow_dispatch' || vars.enabled_workflows == 'all')) runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/help_command.yml b/.github/workflows/help_command.yml index 8ee9dc26a6..59a75f4de3 100644 --- a/.github/workflows/help_command.yml +++ b/.github/workflows/help_command.yml @@ -6,7 +6,7 @@ name: Show the slash commands help jobs: example: - if: ${{ github.event.client_payload.github.job == 'command_dispatch' }} + if: (${{ ! github.event.repository.fork }} && ${{ github.event.client_payload.github.job == 'command_dispatch' }}) runs-on: ubuntu-latest steps: - name: Checkout repository diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index eabf810d39..5b8618a15d 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -80,6 +80,7 @@ jobs: # `env` context is unavailable outside of "steps" contexts. setup: name: Set variables + if: ${{ github.event_name == 'workflow_dispatch' || ! github.event.repository.fork }} runs-on: ubuntu-latest outputs: cudaq_test_image: ${{ steps.vars.outputs.cudaq_test_image }} diff --git a/.github/workflows/nvqc_regression_tests.yml b/.github/workflows/nvqc_regression_tests.yml index e42dbd7db3..b6af5edfff 100644 --- a/.github/workflows/nvqc_regression_tests.yml +++ b/.github/workflows/nvqc_regression_tests.yml @@ -47,6 +47,7 @@ jobs: # `env` context is unavailable outside of "steps" contexts. setup: name: Set variables + if: ${{ github.event_name == 'workflow_dispatch' || ! github.event.repository.fork }} runs-on: ubuntu-latest outputs: cudaq_test_image: ${{ steps.vars.outputs.cudaq_test_image }} diff --git a/.github/workflows/prebuilt_binaries.yml b/.github/workflows/prebuilt_binaries.yml index 5530c2b673..b47df708bc 100644 --- a/.github/workflows/prebuilt_binaries.yml +++ b/.github/workflows/prebuilt_binaries.yml @@ -31,6 +31,7 @@ name: Pre-built binaries jobs: build_installer: name: Build CUDA Quantum assets + if: ${{ ! github.event.repository.fork }} runs-on: ${{ (contains(inputs.platform, 'arm') && 'linux-arm64-cpu8') || 'linux-amd64-cpu8' }} permissions: contents: read @@ -190,6 +191,7 @@ jobs: build_openmpi: name: Minimal OpenMPI installation + if: ${{ ! github.event.repository.fork }} runs-on: ${{ (contains(inputs.platform, 'arm') && 'linux-arm64-cpu8') || 'linux-amd64-cpu8' }} permissions: contents: read @@ -248,6 +250,7 @@ jobs: create_test_config: name: Prepare validation + if: ${{ ! github.event.repository.fork }} runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/prepare_deployment.yml b/.github/workflows/prepare_deployment.yml index 4874a70fec..d952d393d1 100644 --- a/.github/workflows/prepare_deployment.yml +++ b/.github/workflows/prepare_deployment.yml @@ -14,7 +14,7 @@ jobs: pr_info: name: Store PR info runs-on: ubuntu-latest - if: github.event.pull_request.merged == true + if: (${{ ! github.event.repository.fork }} && github.event.pull_request.merged == true) permissions: {} steps: diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml index 6f5357d67a..22ff8efb28 100644 --- a/.github/workflows/publishing.yml +++ b/.github/workflows/publishing.yml @@ -32,7 +32,7 @@ name: Publishing jobs: assets: name: Assets - if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' + if: (${{ github.event_name == 'workflow_dispatch' || ! github.event.repository.fork }} && (github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success')) runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/publishing_stable.yml b/.github/workflows/publishing_stable.yml index 1be177b484..5b90687b54 100644 --- a/.github/workflows/publishing_stable.yml +++ b/.github/workflows/publishing_stable.yml @@ -16,6 +16,7 @@ name: Push stable release jobs: ngc_quantum: name: Publish to stable + if: ${{ github.event_name == 'workflow_dispatch' || ! github.event.repository.fork }} runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/python_wheels.yml b/.github/workflows/python_wheels.yml index e52969f102..441f2675c6 100644 --- a/.github/workflows/python_wheels.yml +++ b/.github/workflows/python_wheels.yml @@ -33,6 +33,7 @@ name: Python wheels jobs: build_wheel: name: Build Python ${{ inputs.python_version }} wheel + if: ${{ ! github.event.repository.fork }} runs-on: ${{ (contains(inputs.platform, 'arm') && 'linux-arm64-cpu8') || 'linux-amd64-cpu8' }} permissions: contents: read @@ -136,6 +137,7 @@ jobs: create_test_config: name: Prepare validation + if: ${{ ! github.event.repository.fork }} runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/repo_checks.yml b/.github/workflows/repo_checks.yml index f5d92d5b1f..02aae32beb 100644 --- a/.github/workflows/repo_checks.yml +++ b/.github/workflows/repo_checks.yml @@ -12,6 +12,7 @@ jobs: links: runs-on: ubuntu-latest name: "Check links" + if: ${{ github.event_name == 'workflow_dispatch' || ! github.event.repository.fork }} steps: - name: Checkout repository uses: actions/checkout@v4 @@ -29,6 +30,7 @@ jobs: license_headers: name: Check license headers + if: ${{ ! github.event.repository.fork }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -39,6 +41,7 @@ jobs: filters: name: Filter files to check + if: ${{ ! github.event.repository.fork }} runs-on: ubuntu-latest outputs: diff --git a/.github/workflows/show_context_command.yml b/.github/workflows/show_context_command.yml index 7ddbecae11..215371a060 100644 --- a/.github/workflows/show_context_command.yml +++ b/.github/workflows/show_context_command.yml @@ -6,7 +6,7 @@ name: Show the context available to slash commands jobs: example: - if: ${{ github.event.client_payload.github.job == 'command_dispatch' }} + if: (${{ ! github.event.repository.fork }} && ${{ github.event.client_payload.github.job == 'command_dispatch' }}) runs-on: ubuntu-latest steps: - name: Show context diff --git a/.github/workflows/test_in_devenv.yml b/.github/workflows/test_in_devenv.yml index 16f3670fc5..233f3f3ac7 100644 --- a/.github/workflows/test_in_devenv.yml +++ b/.github/workflows/test_in_devenv.yml @@ -27,6 +27,7 @@ name: Run CI within the dev environment container jobs: build_and_test: name: Dev environment (Debug) + if: ${{ ! github.event.repository.fork }} runs-on: ${{ (contains(inputs.platform, 'arm') && 'linux-arm64-cpu8') || 'linux-amd64-cpu8' }} permissions: contents: read @@ -149,6 +150,7 @@ jobs: build_and_test_python: name: Dev environment (Python) + if: ${{ ! github.event.repository.fork }} runs-on: ${{ (contains(inputs.platform, 'arm') && 'linux-arm64-cpu8') || 'linux-amd64-cpu8' }} permissions: contents: read