Skip to content

feat: allow checkout of fork repo on workflow approval #1635

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

Closed
wants to merge 13 commits into from
Closed
11 changes: 8 additions & 3 deletions .github/workflows/ami-release-nix-single.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,20 @@ permissions:
id-token: write

jobs:
checkout:
uses: ./.github/workflows/shared-checkout.yml

build:
needs: checkout
runs-on: arm-runner
timeout-minutes: 150

steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Download repository
uses: actions/download-artifact@v4
with:
ref: ${{ github.event.inputs.branch }}
name: repository
path: .

- name: Get current branch SHA
id: get_sha
Expand Down
22 changes: 16 additions & 6 deletions .github/workflows/ami-release-nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,21 @@ permissions:
id-token: write

jobs:
checkout:
uses: ./.github/workflows/shared-checkout.yml

prepare:
needs: checkout
runs-on: ubuntu-latest
outputs:
postgres_versions: ${{ steps.set-versions.outputs.postgres_versions }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Download repository
uses: actions/download-artifact@v4
with:
name: repository
path: .

- uses: DeterminateSystems/nix-installer-action@main

- name: Set PostgreSQL versions
Expand All @@ -33,7 +40,7 @@ jobs:
echo "postgres_versions=$VERSIONS" >> $GITHUB_OUTPUT

build:
needs: prepare
needs: [checkout, prepare]
strategy:
matrix:
postgres_version: ${{ fromJson(needs.prepare.outputs.postgres_versions) }}
Expand All @@ -47,8 +54,11 @@ jobs:
timeout-minutes: 150

steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Download repository
uses: actions/download-artifact@v4
with:
name: repository
path: .

- uses: DeterminateSystems/nix-installer-action@main

Expand Down
35 changes: 22 additions & 13 deletions .github/workflows/check-shellscripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,29 @@ permissions:
contents: read

jobs:
checkout:
uses: ./.github/workflows/shared-checkout.yml

build:
needs: checkout
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -e SC2001 -e SC2002 -e SC2143
with:
scandir: './ansible/files/admin_api_scripts'
- name: Download repository
uses: actions/download-artifact@v4
with:
name: repository
path: .

- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -e SC2001 -e SC2002 -e SC2143
with:
scandir: './ansible/files/admin_api_scripts'

- name: Run ShellCheck on pg_upgrade scripts
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -e SC2001 -e SC2002 -e SC2143
with:
scandir: './ansible/files/admin_api_scripts/pg_upgrade_scripts'
- name: Run ShellCheck on pg_upgrade scripts
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -e SC2001 -e SC2002 -e SC2143
with:
scandir: './ansible/files/admin_api_scripts/pg_upgrade_scripts'
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@ permissions:
contents: read

jobs:
checkout:
uses: ./.github/workflows/shared-checkout.yml

check-release-version:
needs: checkout
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Download repository
uses: actions/download-artifact@v4
with:
name: repository
path: .

- name: Load postgres_release values
id: load_postgres_release
Expand Down
28 changes: 22 additions & 6 deletions .github/workflows/dockerhub-release-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,22 @@ permissions:
id-token: write

jobs:
checkout:
uses: ./.github/workflows/shared-checkout.yml

prepare:
needs: checkout
runs-on: ubuntu-latest
outputs:
matrix_config: ${{ steps.set-matrix.outputs.matrix_config }}
steps:
- name: Download repository
uses: actions/download-artifact@v4
with:
name: repository
path: .

- uses: DeterminateSystems/nix-installer-action@main
- name: Checkout Repo
uses: actions/checkout@v3
- name: Generate build matrix
id: set-matrix
run: |
Expand Down Expand Up @@ -53,7 +61,12 @@ jobs:
outputs:
build_args: ${{ steps.args.outputs.result }}
steps:
- uses: actions/checkout@v3
- name: Download repository
uses: actions/download-artifact@v4
with:
name: repository
path: .

- uses: DeterminateSystems/nix-installer-action@main
- name: Set PostgreSQL version environment variable
run: echo "POSTGRES_MAJOR_VERSION=${{ matrix.version }}" >> $GITHUB_ENV
Expand All @@ -77,7 +90,12 @@ jobs:
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'arm-runner' }}
timeout-minutes: 180
steps:
- uses: actions/checkout@v3
- name: Download repository
uses: actions/download-artifact@v4
with:
name: repository
path: .

- uses: DeterminateSystems/nix-installer-action@main
- run: docker context create builders
- uses: docker/setup-buildx-action@v3
Expand Down Expand Up @@ -132,7 +150,6 @@ jobs:
include: ${{ fromJson(needs.prepare.outputs.matrix_config).include }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v2
Expand Down Expand Up @@ -175,7 +192,6 @@ jobs:
needs: [prepare, merge_manifest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main

- name: Debug Input from Prepare
Expand Down
28 changes: 22 additions & 6 deletions .github/workflows/manual-docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,22 @@ permissions:
contents: read

jobs:
checkout:
uses: ./.github/workflows/shared-checkout.yml

prepare:
needs: checkout
runs-on: ubuntu-latest
outputs:
matrix_config: ${{ steps.set-matrix.outputs.matrix_config }}
steps:
- name: Download repository
uses: actions/download-artifact@v4
with:
name: repository
path: .

- uses: DeterminateSystems/nix-installer-action@main
- name: Checkout Repo
uses: actions/checkout@v3
- name: Generate build matrix
id: set-matrix
run: |
Expand Down Expand Up @@ -50,7 +58,12 @@ jobs:
outputs:
build_args: ${{ steps.args.outputs.result }}
steps:
- uses: actions/checkout@v3
- name: Download repository
uses: actions/download-artifact@v4
with:
name: repository
path: .

- uses: DeterminateSystems/nix-installer-action@main
- name: Set PostgreSQL version environment variable
run: echo "POSTGRES_MAJOR_VERSION=${{ matrix.version }}" >> $GITHUB_ENV
Expand All @@ -74,7 +87,12 @@ jobs:
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'arm-runner' }}
timeout-minutes: 180
steps:
- uses: actions/checkout@v3
- name: Download repository
uses: actions/download-artifact@v4
with:
name: repository
path: .

- uses: DeterminateSystems/nix-installer-action@main
- run: docker context create builders
- uses: docker/setup-buildx-action@v3
Expand Down Expand Up @@ -141,7 +159,6 @@ jobs:
include: ${{ fromJson(needs.prepare.outputs.matrix_config).include }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v2
Expand Down Expand Up @@ -184,7 +201,6 @@ jobs:
needs: [prepare, merge_manifest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main

- name: Debug Input from Prepare
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/mirror-postgrest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,21 @@ permissions:
contents: read

jobs:
checkout:
uses: ./.github/workflows/shared-checkout.yml

version:
needs: checkout
runs-on: ubuntu-latest
outputs:
postgrest_release: ${{ steps.args.outputs.result }}
steps:
- uses: actions/checkout@v4
- name: Download repository
uses: actions/download-artifact@v4
with:
name: repository
path: .

- id: args
uses: mikefarah/yq@master
with:
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ permissions:
id-token: write

jobs:
checkout:
uses: ./.github/workflows/shared-checkout.yml

build-run-image:
needs: checkout
strategy:
fail-fast: false
matrix:
Expand All @@ -27,13 +31,12 @@ jobs:
runs-on: ${{ matrix.runner }}
timeout-minutes: 180
steps:

- name: Check out code
uses: actions/checkout@v4
- name: Download repository
uses: actions/download-artifact@v4
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
fetch-depth: 0
fetch-tags: true
name: repository
path: .

- name: aws-creds
uses: aws-actions/configure-aws-credentials@v4
with:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/publish-migrations-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ on:
workflow_dispatch:

jobs:
checkout:
uses: ./.github/workflows/shared-checkout.yml

build:
needs: checkout
runs-on: [self-hosted, linux]
timeout-minutes: 15
permissions:
Expand All @@ -21,9 +25,6 @@ jobs:
env:
GITHUB_REF: ${{ github.ref }}

- name: Checkout Repo
uses: actions/checkout@v2

- name: Merging migration files
run: cat $(ls -1) > ../migration-output.sql
working-directory: ${{ github.workspace }}/migrations/db/migrations
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/publish-migrations-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ on:
workflow_dispatch:

jobs:
checkout:
uses: ./.github/workflows/shared-checkout.yml

build:
needs: checkout
runs-on: [self-hosted, linux]
timeout-minutes: 15
permissions:
id-token: write
contents: read

steps:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Merging migration files
run: cat $(ls -1) > ../migration-output.sql
working-directory: ${{ github.workspace }}/migrations/db/migrations
Expand Down
Loading