Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable workflows for a forked repository #1932

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/cla_assistant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/clean_caches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand 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

Expand 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

Expand Down Expand Up @@ -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

Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/clean_up.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -67,6 +67,7 @@ jobs:

ghcr_images:
name: Clean up GHCR images
if: ${{ ! github.event.repository.fork }}
runs-on: ubuntu-latest

strategy:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/command_dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/create_cache_command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/delete_tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deployments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/dev_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docker_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ name: Docker images
jobs:
metadata:
name: Metadata
if: ${{ ! github.event.repository.fork }}
runs-on: ubuntu-latest
permissions: {}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh_registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/help_command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/nvqc_regression_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/prebuilt_binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -248,6 +250,7 @@ jobs:

create_test_config:
name: Prepare validation
if: ${{ ! github.event.repository.fork }}
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare_deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publishing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publishing_stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/python_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -136,6 +137,7 @@ jobs:

create_test_config:
name: Prepare validation
if: ${{ ! github.event.repository.fork }}
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/repo_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -39,6 +41,7 @@ jobs:

filters:
name: Filter files to check
if: ${{ ! github.event.repository.fork }}
runs-on: ubuntu-latest

outputs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/show_context_command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test_in_devenv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading