Skip to content

Commit cf3b20b

Browse files
committed
feat: use shared workflow for repeated checkout lines
1 parent 04794c3 commit cf3b20b

16 files changed

+65
-249
lines changed

.github/workflows/ami-release-nix-single.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,7 @@ jobs:
2323
timeout-minutes: 150
2424

2525
steps:
26-
- name: Checkout Repo
27-
uses: actions/checkout@v3
28-
with:
29-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
30-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
31-
fetch-depth: 0
32-
fetch-tags: true
33-
token: ${{ secrets.GITHUB_TOKEN }}
26+
- uses: ./.github/workflows/shared-checkout.yml
3427

3528
- name: Get current branch SHA
3629
id: get_sha

.github/workflows/ami-release-nix.yml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,7 @@ jobs:
2121
outputs:
2222
postgres_versions: ${{ steps.set-versions.outputs.postgres_versions }}
2323
steps:
24-
- name: Checkout Repo
25-
uses: actions/checkout@v3
26-
with:
27-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
28-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
29-
fetch-depth: 0
30-
fetch-tags: true
31-
token: ${{ secrets.GITHUB_TOKEN }}
24+
- uses: ./.github/workflows/shared-checkout.yml
3225

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

@@ -53,14 +46,7 @@ jobs:
5346
timeout-minutes: 150
5447

5548
steps:
56-
- name: Checkout Repo
57-
uses: actions/checkout@v3
58-
with:
59-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
60-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
61-
fetch-depth: 0
62-
fetch-tags: true
63-
token: ${{ secrets.GITHUB_TOKEN }}
49+
- uses: ./.github/workflows/shared-checkout.yml
6450

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

.github/workflows/check-shellscripts.yml

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,18 @@ jobs:
1414
build:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v3
18-
with:
19-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
20-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
21-
fetch-depth: 0
22-
fetch-tags: true
23-
token: ${{ secrets.GITHUB_TOKEN }}
24-
- name: Run ShellCheck
25-
uses: ludeeus/action-shellcheck@master
26-
env:
27-
SHELLCHECK_OPTS: -e SC2001 -e SC2002 -e SC2143
28-
with:
29-
scandir: './ansible/files/admin_api_scripts'
17+
- uses: ./.github/workflows/shared-checkout.yml
3018

31-
- name: Run ShellCheck on pg_upgrade scripts
32-
uses: ludeeus/action-shellcheck@master
33-
env:
34-
SHELLCHECK_OPTS: -e SC2001 -e SC2002 -e SC2143
35-
with:
36-
scandir: './ansible/files/admin_api_scripts/pg_upgrade_scripts'
19+
- name: Run ShellCheck
20+
uses: ludeeus/action-shellcheck@master
21+
env:
22+
SHELLCHECK_OPTS: -e SC2001 -e SC2002 -e SC2143
23+
with:
24+
scandir: './ansible/files/admin_api_scripts'
25+
26+
- name: Run ShellCheck on pg_upgrade scripts
27+
uses: ludeeus/action-shellcheck@master
28+
env:
29+
SHELLCHECK_OPTS: -e SC2001 -e SC2002 -e SC2143
30+
with:
31+
scandir: './ansible/files/admin_api_scripts/pg_upgrade_scripts'

.github/workflows/ci.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,7 @@ jobs:
1111
timeout-minutes: 5
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Checkout Repo
15-
uses: actions/checkout@v3
16-
with:
17-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
18-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
19-
fetch-depth: 0
20-
fetch-tags: true
21-
token: ${{ secrets.GITHUB_TOKEN }}
14+
- uses: ./.github/workflows/shared-checkout.yml
2215

2316
- name: Load postgres_release values
2417
id: load_postgres_release

.github/workflows/dockerhub-release-matrix.yml

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,7 @@ jobs:
2121
matrix_config: ${{ steps.set-matrix.outputs.matrix_config }}
2222
steps:
2323
- uses: DeterminateSystems/nix-installer-action@main
24-
- name: Checkout Repo
25-
uses: actions/checkout@v3
26-
with:
27-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
28-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
29-
fetch-depth: 0
30-
fetch-tags: true
31-
token: ${{ secrets.GITHUB_TOKEN }}
24+
- uses: ./.github/workflows/shared-checkout.yml
3225
- name: Generate build matrix
3326
id: set-matrix
3427
run: |
@@ -59,13 +52,7 @@ jobs:
5952
outputs:
6053
build_args: ${{ steps.args.outputs.result }}
6154
steps:
62-
- uses: actions/checkout@v3
63-
with:
64-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
65-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
66-
fetch-depth: 0
67-
fetch-tags: true
68-
token: ${{ secrets.GITHUB_TOKEN }}
55+
- uses: ./.github/workflows/shared-checkout.yml
6956
- uses: DeterminateSystems/nix-installer-action@main
7057
- name: Set PostgreSQL version environment variable
7158
run: echo "POSTGRES_MAJOR_VERSION=${{ matrix.version }}" >> $GITHUB_ENV
@@ -89,13 +76,7 @@ jobs:
8976
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'arm-runner' }}
9077
timeout-minutes: 180
9178
steps:
92-
- uses: actions/checkout@v3
93-
with:
94-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
95-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
96-
fetch-depth: 0
97-
fetch-tags: true
98-
token: ${{ secrets.GITHUB_TOKEN }}
79+
- uses: ./.github/workflows/shared-checkout.yml
9980
- uses: DeterminateSystems/nix-installer-action@main
10081
- run: docker context create builders
10182
- uses: docker/setup-buildx-action@v3
@@ -150,13 +131,7 @@ jobs:
150131
include: ${{ fromJson(needs.prepare.outputs.matrix_config).include }}
151132
runs-on: ubuntu-latest
152133
steps:
153-
- uses: actions/checkout@v3
154-
with:
155-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
156-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
157-
fetch-depth: 0
158-
fetch-tags: true
159-
token: ${{ secrets.GITHUB_TOKEN }}
134+
- uses: ./.github/workflows/shared-checkout.yml
160135
- uses: DeterminateSystems/nix-installer-action@main
161136
- uses: docker/setup-buildx-action@v3
162137
- uses: docker/login-action@v2
@@ -199,13 +174,7 @@ jobs:
199174
needs: [prepare, merge_manifest]
200175
runs-on: ubuntu-latest
201176
steps:
202-
- uses: actions/checkout@v3
203-
with:
204-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
205-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
206-
fetch-depth: 0
207-
fetch-tags: true
208-
token: ${{ secrets.GITHUB_TOKEN }}
177+
- uses: ./.github/workflows/shared-checkout.yml
209178
- uses: DeterminateSystems/nix-installer-action@main
210179

211180
- name: Debug Input from Prepare

.github/workflows/manual-docker-release.yml

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,7 @@ jobs:
1818
matrix_config: ${{ steps.set-matrix.outputs.matrix_config }}
1919
steps:
2020
- uses: DeterminateSystems/nix-installer-action@main
21-
- name: Checkout Repo
22-
uses: actions/checkout@v3
23-
with:
24-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
25-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
26-
fetch-depth: 0
27-
fetch-tags: true
28-
token: ${{ secrets.GITHUB_TOKEN }}
21+
- uses: ./.github/workflows/shared-checkout.yml
2922
- name: Generate build matrix
3023
id: set-matrix
3124
run: |
@@ -56,13 +49,7 @@ jobs:
5649
outputs:
5750
build_args: ${{ steps.args.outputs.result }}
5851
steps:
59-
- uses: actions/checkout@v3
60-
with:
61-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
62-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
63-
fetch-depth: 0
64-
fetch-tags: true
65-
token: ${{ secrets.GITHUB_TOKEN }}
52+
- uses: ./.github/workflows/shared-checkout.yml
6653
- uses: DeterminateSystems/nix-installer-action@main
6754
- name: Set PostgreSQL version environment variable
6855
run: echo "POSTGRES_MAJOR_VERSION=${{ matrix.version }}" >> $GITHUB_ENV
@@ -86,13 +73,7 @@ jobs:
8673
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'arm-runner' }}
8774
timeout-minutes: 180
8875
steps:
89-
- uses: actions/checkout@v3
90-
with:
91-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
92-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
93-
fetch-depth: 0
94-
fetch-tags: true
95-
token: ${{ secrets.GITHUB_TOKEN }}
76+
- uses: ./.github/workflows/shared-checkout.yml
9677
- uses: DeterminateSystems/nix-installer-action@main
9778
- run: docker context create builders
9879
- uses: docker/setup-buildx-action@v3
@@ -159,13 +140,7 @@ jobs:
159140
include: ${{ fromJson(needs.prepare.outputs.matrix_config).include }}
160141
runs-on: ubuntu-latest
161142
steps:
162-
- uses: actions/checkout@v3
163-
with:
164-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
165-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
166-
fetch-depth: 0
167-
fetch-tags: true
168-
token: ${{ secrets.GITHUB_TOKEN }}
143+
- uses: ./.github/workflows/shared-checkout.yml
169144
- uses: DeterminateSystems/nix-installer-action@main
170145
- uses: docker/setup-buildx-action@v3
171146
- uses: docker/login-action@v2
@@ -208,13 +183,7 @@ jobs:
208183
needs: [prepare, merge_manifest]
209184
runs-on: ubuntu-latest
210185
steps:
211-
- uses: actions/checkout@v3
212-
with:
213-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
214-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
215-
fetch-depth: 0
216-
fetch-tags: true
217-
token: ${{ secrets.GITHUB_TOKEN }}
186+
- uses: ./.github/workflows/shared-checkout.yml
218187
- uses: DeterminateSystems/nix-installer-action@main
219188

220189
- name: Debug Input from Prepare

.github/workflows/mirror-postgrest.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,8 @@ jobs:
1717
outputs:
1818
postgrest_release: ${{ steps.args.outputs.result }}
1919
steps:
20-
- uses: actions/checkout@v4
21-
with:
22-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
23-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
24-
fetch-depth: 0
25-
fetch-tags: true
26-
token: ${{ secrets.GITHUB_TOKEN }}
20+
- uses: ./.github/workflows/shared-checkout.yml
21+
2722
- id: args
2823
uses: mikefarah/yq@master
2924
with:

.github/workflows/nix-build.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,9 @@ jobs:
2727
runs-on: ${{ matrix.runner }}
2828
timeout-minutes: 180
2929
steps:
30-
3130
- name: Check out code
32-
uses: actions/checkout@v4
33-
with:
34-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
35-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
36-
fetch-depth: 0
37-
fetch-tags: true
38-
token: ${{ secrets.GITHUB_TOKEN }}
31+
uses: ./.github/workflows/shared-checkout.yml
32+
3933
- name: aws-creds
4034
uses: aws-actions/configure-aws-credentials@v4
4135
with:

.github/workflows/publish-migrations-prod.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,7 @@ jobs:
2121
env:
2222
GITHUB_REF: ${{ github.ref }}
2323

24-
- name: Checkout Repo
25-
uses: actions/checkout@v2
26-
with:
27-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
28-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
29-
fetch-depth: 0
30-
fetch-tags: true
31-
token: ${{ secrets.GITHUB_TOKEN }}
24+
- uses: ./.github/workflows/shared-checkout.yml
3225

3326
- name: Merging migration files
3427
run: cat $(ls -1) > ../migration-output.sql

.github/workflows/publish-migrations-staging.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,7 @@ jobs:
1515
contents: read
1616

1717
steps:
18-
- name: Checkout Repo
19-
uses: actions/checkout@v2
20-
with:
21-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
22-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
23-
fetch-depth: 0
24-
fetch-tags: true
25-
token: ${{ secrets.GITHUB_TOKEN }}
18+
- uses: ./.github/workflows/shared-checkout.yml
2619

2720
- name: Merging migration files
2821
run: cat $(ls -1) > ../migration-output.sql

0 commit comments

Comments
 (0)