Skip to content

feat: allow checkout of fork repository on workflow approval #1643

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

Merged
merged 2 commits into from
Jun 17, 2025
Merged
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
12 changes: 12 additions & 0 deletions .github/actions/shared-checkout/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Checkout
description: Checkout repository for pull requests and branches
runs:
using: "composite"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
fetch-tags: true
2 changes: 1 addition & 1 deletion .github/workflows/ami-release-nix-single.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
with:
ref: ${{ github.event.inputs.branch }}

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ami-release-nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
postgres_versions: ${{ steps.set-versions.outputs.postgres_versions }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: supabase/postgres/.github/actions/shared-checkout@HEAD

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

- name: Set PostgreSQL versions
Expand All @@ -48,7 +48,7 @@ jobs:

steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: supabase/postgres/.github/actions/shared-checkout@HEAD

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

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/check-shellscripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout Repo
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: supabase/postgres/.github/actions/shared-checkout@HEAD

- name: Load postgres_release values
id: load_postgres_release
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/dockerhub-release-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:
- uses: DeterminateSystems/nix-installer-action@main
- name: Checkout Repo
uses: actions/checkout@v3
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
- name: Generate build matrix
id: set-matrix
run: |
Expand Down Expand Up @@ -53,7 +53,8 @@ jobs:
outputs:
build_args: ${{ steps.args.outputs.result }}
steps:
- uses: actions/checkout@v3
- name: Checkout Repo
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
- 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 +78,8 @@ jobs:
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'arm-runner' }}
timeout-minutes: 180
steps:
- uses: actions/checkout@v3
- name: Checkout Repo
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
- uses: DeterminateSystems/nix-installer-action@main
- run: docker context create builders
- uses: docker/setup-buildx-action@v3
Expand Down Expand Up @@ -132,7 +134,8 @@ jobs:
include: ${{ fromJson(needs.prepare.outputs.matrix_config).include }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout Repo
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
- uses: DeterminateSystems/nix-installer-action@main
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v2
Expand Down Expand Up @@ -175,7 +178,8 @@ jobs:
needs: [prepare, merge_manifest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout Repo
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
- uses: DeterminateSystems/nix-installer-action@main

- name: Debug Input from Prepare
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/manual-docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:
- uses: DeterminateSystems/nix-installer-action@main
- name: Checkout Repo
uses: actions/checkout@v3
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
- name: Generate build matrix
id: set-matrix
run: |
Expand Down Expand Up @@ -50,7 +50,8 @@ jobs:
outputs:
build_args: ${{ steps.args.outputs.result }}
steps:
- uses: actions/checkout@v3
- name: Checkout Repo
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
- 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 +75,8 @@ jobs:
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'arm-runner' }}
timeout-minutes: 180
steps:
- uses: actions/checkout@v3
- name: Checkout Repo
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
- uses: DeterminateSystems/nix-installer-action@main
- run: docker context create builders
- uses: docker/setup-buildx-action@v3
Expand Down Expand Up @@ -141,7 +143,8 @@ jobs:
include: ${{ fromJson(needs.prepare.outputs.matrix_config).include }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout Repo
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
- uses: DeterminateSystems/nix-installer-action@main
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v2
Expand Down Expand Up @@ -184,7 +187,8 @@ jobs:
needs: [prepare, merge_manifest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout Repo
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
- uses: DeterminateSystems/nix-installer-action@main

- name: Debug Input from Prepare
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/mirror-postgrest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ jobs:
outputs:
postgrest_release: ${{ steps.args.outputs.result }}
steps:
- uses: actions/checkout@v4
- name: Checkout Repo
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
- id: args
uses: mikefarah/yq@master
with:
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,11 @@ jobs:
runs-on: ${{ matrix.runner }}
timeout-minutes: 180
steps:

- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
fetch-depth: 0
fetch-tags: true
- name: Checkout Repo
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
- name: aws-creds
uses: aws-actions/configure-aws-credentials@v4
if: ${{ github.secret_source == 'Actions' }}
with:
role-to-assume: ${{ secrets.DEV_AWS_ROLE }}
aws-region: "us-east-1"
Expand All @@ -48,7 +44,7 @@ jobs:
env:
NIX_SIGN_SECRET_KEY: ${{ secrets.NIX_SIGN_SECRET_KEY }}
- name: Log in to Docker Hub
if: matrix.runner != 'macos-latest' && matrix.runner != 'macos-13'
if: matrix.runner != 'macos-latest' && matrix.runner != 'macos-13' && github.secret_source == 'Actions'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-migrations-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
env:
GITHUB_REF: ${{ github.ref }}

- name: Checkout Repo
uses: actions/checkout@v2
- name: Checkout repo
uses: supabase/postgres/.github/actions/shared-checkout@HEAD

- name: Merging migration files
run: cat $(ls -1) > ../migration-output.sql
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/publish-migrations-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ jobs:

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

uses: supabase/postgres/.github/actions/shared-checkout@HEAD
- name: Merging migration files
run: cat $(ls -1) > ../migration-output.sql
working-directory: ${{ github.workspace }}/migrations/db/migrations
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/publish-nix-pgupgrade-bin-flake-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
postgres_versions: ${{ steps.set-versions.outputs.postgres_versions }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: supabase/postgres/.github/actions/shared-checkout@HEAD

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

- name: Set PostgreSQL versions
Expand All @@ -36,8 +36,8 @@ jobs:

steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: supabase/postgres/.github/actions/shared-checkout@HEAD

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

- name: Grab release version
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:

steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: supabase/postgres/.github/actions/shared-checkout@HEAD

- name: Grab release version
id: process_release_version
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish-nix-pgupgrade-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
postgres_versions: ${{ steps.set-versions.outputs.postgres_versions }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: supabase/postgres/.github/actions/shared-checkout@HEAD

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

Expand All @@ -43,7 +43,7 @@ jobs:

steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: supabase/postgres/.github/actions/shared-checkout@HEAD

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

Expand Down Expand Up @@ -94,8 +94,8 @@ jobs:

steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: supabase/postgres/.github/actions/shared-checkout@HEAD

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

- name: Grab release version
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/qemu-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
postgres_versions: ${{ steps.set-versions.outputs.postgres_versions }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: supabase/postgres/.github/actions/shared-checkout@HEAD

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

Expand All @@ -47,7 +47,7 @@ jobs:

steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: supabase/postgres/.github/actions/shared-checkout@HEAD

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

Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
postgres_versions: ${{ steps.set-versions.outputs.postgres_versions }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
uses: supabase/postgres/.github/actions/shared-checkout@HEAD

- name: Clear Nix cache
run: |
Expand Down Expand Up @@ -49,7 +49,8 @@ jobs:
POSTGRES_PORT: 5478
POSTGRES_PASSWORD: password
steps:
- uses: actions/checkout@v4
- name: Checkout Repo
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
- name: Clear Nix cache
run: |
sudo rm -rf /home/runner/.cache/nix
Expand Down Expand Up @@ -86,4 +87,4 @@ jobs:
echo "Detected changes in schema.sql:"
git diff migrations/schema-${{ env.PGMAJOR }}.sql
exit 1
fi
fi
4 changes: 2 additions & 2 deletions .github/workflows/testinfra-ami-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
postgres_versions: ${{ steps.set-versions.outputs.postgres_versions }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
uses: supabase/postgres/.github/actions/shared-checkout@HEAD

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

Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:

steps:
- name: Checkout Repo
uses: actions/checkout@v4
uses: supabase/postgres/.github/actions/shared-checkout@HEAD

- id: args
uses: mikefarah/yq@master
Expand Down
27 changes: 16 additions & 11 deletions docker/nix/build_nix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ nix build .#wal-g-2 -o wal-g-2 -L
nix build .#wal-g-3 -o wal-g-3 -L

# Copy to S3
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./wal-g-2
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./wal-g-3
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./psql_15
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./psql_orioledb_17
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./psql_17
if [[ -n "${AWS_ACCESS_KEY_ID-}" && -n "${AWS_SECRET_ACCESS_KEY-}" ]]; then
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./wal-g-2
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./wal-g-3
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./psql_15
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./psql_orioledb_17
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./psql_17
fi

if [ "$SYSTEM" = "aarch64-linux" ]; then
nix build .#postgresql_15_debug -o ./postgresql_15_debug
Expand All @@ -31,10 +33,13 @@ if [ "$SYSTEM" = "aarch64-linux" ]; then
nix build .#postgresql_orioledb-17_src -o ./postgresql_orioledb-17_src
nix build .#postgresql_17_debug -o ./postgresql_17_debug
nix build .#postgresql_17_src -o ./postgresql_17_src
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_15_debug-debug
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_15_src
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_orioledb-17_debug-debug
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_orioledb-17_src
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_17_debug-debug
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_17_src

if [[ -n "${AWS_ACCESS_KEY_ID-}" && -n "${AWS_SECRET_ACCESS_KEY-}" ]]; then
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_15_debug-debug
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_15_src
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_orioledb-17_debug-debug
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_orioledb-17_src
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_17_debug-debug
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_17_src
fi
fi