Skip to content

Commit cb489ac

Browse files
committed
related workflows to _actions
1 parent 36b9e44 commit cb489ac

12 files changed

Lines changed: 104 additions & 199 deletions

.github/workflows/_checks-expo.yaml

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,6 @@ jobs:
116116
PM_RUN: ${{ inputs.package_manager == 'bun' && 'bun run' || 'pnpm run' }}
117117

118118
steps:
119-
- name: Generate GitHub App Token
120-
id: app-token
121-
if: inputs.github_app_auth != false
122-
uses: actions/create-github-app-token@v2
123-
with:
124-
app-id: ${{ secrets.app_id }}
125-
private-key: ${{ secrets.app_pem }}
126-
repositories: ${{ inputs.github_app_repos }}
127-
128119
- name: Install needed packages
129120
run: |
130121
apt-get update
@@ -141,16 +132,16 @@ jobs:
141132
with:
142133
bun-version: ${{ inputs.bun_version }}
143134

144-
- name: Checkout code
145-
uses: actions/checkout@v4
135+
- name: Checkout with GitHub App
136+
uses: zondax/_actions/checkout-with-app@main
146137
with:
138+
github_app_auth: ${{ inputs.github_app_auth }}
139+
github_app_repos: ${{ inputs.github_app_repos }}
140+
checkout_submodules: ${{ inputs.checkout_submodules }}
147141
ref: ${{ github.event.pull_request.head.sha }}
148-
fetch-depth: 0
149-
submodules: ${{ inputs.checkout_submodules }}
150-
token: ${{ steps.app-token.outputs.token || github.token }}
151-
152-
- name: Patch git clone
153-
run: git config --system --add safe.directory '*'
142+
fetch_depth: 0
143+
app_id: ${{ secrets.app_id }}
144+
app_pem: ${{ secrets.app_pem }}
154145

155146
- name: Setup pnpm
156147
if: ${{ inputs.package_manager == 'pnpm' }}

.github/workflows/_checks-golang.yaml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ on:
4545
required: false
4646
type: boolean
4747
default: true
48+
secrets:
49+
app_id:
50+
description: "GitHub App ID"
51+
required: false
52+
app_pem:
53+
description: "GitHub App PEM"
54+
required: false
4855

4956
permissions:
5057
contents: read
@@ -63,25 +70,19 @@ jobs:
6370
coverage_message: ${{ steps.coverage-check.outputs.coverage_message }}
6471

6572
steps:
66-
- name: Generate GitHub App Token
67-
id: app-token
68-
if: inputs.github_app_auth != false
69-
uses: actions/create-github-app-token@v1
73+
- name: Checkout with GitHub App
74+
uses: zondax/_actions/checkout-with-app@main
7075
with:
71-
app-id: ${{ secrets.app_id }}
72-
private-key: ${{ secrets.app_pem }}
73-
repositories: |
76+
github_app_auth: ${{ inputs.github_app_auth }}
77+
github_app_repos: |
78+
${{ github.repository }}
7479
${{ inputs.github_app_repos }}
75-
76-
- name: Checkout
77-
uses: actions/checkout@v4
78-
with:
79-
submodules: true
80-
token: ${{ steps.app-token.outputs.token || github.token }}
80+
checkout_submodules: true
81+
app_id: ${{ secrets.app_id }}
82+
app_pem: ${{ secrets.app_pem }}
8183

8284
- name: Build
8385
run: |
84-
git config --global --add safe.directory "*"
8586
cd ${{ inputs.package_path }}
8687
make go-build
8788

.github/workflows/_checks-infra.yaml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,13 @@ jobs:
4949
timeout-minutes: 15
5050

5151
steps:
52-
- name: Generate GitHub App Token
53-
id: app-token
54-
if: inputs.github_app_auth != false
55-
uses: actions/create-github-app-token@v1
52+
- name: Checkout with GitHub App
53+
uses: zondax/_actions/checkout-with-app@main
5654
with:
57-
app-id: ${{ secrets.app_id }}
58-
private-key: ${{ secrets.app_pem }}
59-
repositories: |
60-
${{ inputs.github_app_repos }}
61-
62-
- name: Checkout code
63-
uses: actions/checkout@v4
64-
with:
65-
token: ${{ steps.app-token.outputs.token || github.token }}
55+
github_app_auth: ${{ inputs.github_app_auth }}
56+
github_app_repos: ${{ inputs.github_app_repos }}
57+
app_id: ${{ secrets.app_id }}
58+
app_pem: ${{ secrets.app_pem }}
6659

6760
- name: Install dependencies
6861
run: |

.github/workflows/_checks-rs.yaml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -189,30 +189,20 @@ jobs:
189189
PM_RUN: ${{ inputs.package_manager == 'bun' && 'bun run' || 'pnpm run' }}
190190

191191
steps:
192-
- name: Generate GitHub App Token
193-
id: app-token
194-
if: inputs.github_app_auth != false
195-
uses: actions/create-github-app-token@v2
196-
with:
197-
app-id: ${{ secrets.app_id }}
198-
private-key: ${{ secrets.app_pem }}
199-
repositories: ${{ inputs.github_app_repos }}
200-
201192
- name: Install needed packages
202193
run: |
203194
apt-get update
204195
apt-get install -y git curl build-essential pkg-config libssl-dev
205196
206-
- name: Checkout code
207-
uses: actions/checkout@v4
197+
- name: Checkout with GitHub App
198+
uses: zondax/_actions/checkout-with-app@main
208199
with:
200+
github_app_auth: ${{ inputs.github_app_auth }}
201+
github_app_repos: ${{ inputs.github_app_repos }}
202+
checkout_submodules: ${{ inputs.checkout_submodules }}
209203
ref: ${{ github.event.pull_request.head.sha }}
210-
fetch-depth: 0
211-
submodules: ${{ inputs.checkout_submodules }}
212-
token: ${{ steps.app-token.outputs.token || github.token }}
213-
214-
- name: Patch git clone
215-
run: git config --system --add safe.directory '*'
204+
app_id: ${{ secrets.app_id }}
205+
app_pem: ${{ secrets.app_pem }}
216206

217207
- name: Install node
218208
if: inputs.enable_node

.github/workflows/_checks-ts.yaml

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,10 @@ jobs:
116116
PM_RUN: ${{ inputs.package_manager == 'bun' && 'bun run' || 'pnpm run' }}
117117

118118
steps:
119-
- name: Generate GitHub App Token
120-
id: app-token
121-
if: inputs.github_app_auth != false
122-
uses: actions/create-github-app-token@v2
123-
with:
124-
app-id: ${{ secrets.app_id }}
125-
private-key: ${{ secrets.app_pem }}
126-
repositories: ${{ inputs.github_app_repos }}
127-
128119
- name: Install needed packages
129120
run: |
130121
apt-get update
131-
apt-get install -y git unzip
122+
apt-get install -y git unzip jq
132123
133124
- name: Install node
134125
uses: actions/setup-node@v4
@@ -140,16 +131,15 @@ jobs:
140131
with:
141132
bun-version: ${{ inputs.bun_version }}
142133

143-
- name: Checkout code
144-
uses: actions/checkout@v4
134+
- name: Checkout with GitHub App
135+
uses: zondax/_actions/checkout-with-app@main
145136
with:
137+
github_app_auth: ${{ inputs.github_app_auth }}
138+
github_app_repos: ${{ inputs.github_app_repos }}
139+
checkout_submodules: ${{ inputs.checkout_submodules }}
146140
ref: ${{ github.event.pull_request.head.sha }}
147-
fetch-depth: 0
148-
submodules: ${{ inputs.checkout_submodules }}
149-
token: ${{ steps.app-token.outputs.token || github.token }}
150-
151-
- name: Patch git clone
152-
run: git config --system --add safe.directory '*'
141+
app_id: ${{ secrets.app_id }}
142+
app_pem: ${{ secrets.app_pem }}
153143

154144
- name: Setup pnpm
155145
uses: pnpm/action-setup@v4

.github/workflows/_checks-yaml.yaml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,13 @@ jobs:
4444
timeout-minutes: 15
4545

4646
steps:
47-
- name: Generate GitHub App Token
48-
id: app-token
49-
if: inputs.github_app_auth != false
50-
uses: actions/create-github-app-token@v1
47+
- name: Checkout with GitHub App
48+
uses: zondax/_actions/checkout-with-app@main
5149
with:
52-
app-id: ${{ secrets.app_id }}
53-
private-key: ${{ secrets.app_pem }}
54-
repositories: |
55-
${{ inputs.github_app_repos }}
56-
57-
- name: Checkout code
58-
uses: actions/checkout@v4
59-
with:
60-
token: ${{ steps.app-token.outputs.token || github.token }}
50+
github_app_auth: ${{ inputs.github_app_auth }}
51+
github_app_repos: ${{ inputs.github_app_repos }}
52+
app_id: ${{ secrets.app_id }}
53+
app_pem: ${{ secrets.app_pem }}
6154

6255
- name: Install make
6356
run: |

.github/workflows/_cloudflare-r2-release.yml

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -255,23 +255,15 @@ jobs:
255255
success: ${{ steps.build.outputs.success }}
256256

257257
steps:
258-
- name: Generate GitHub App Token
259-
id: app-token
260-
if: inputs.github_app_auth != false
261-
uses: actions/create-github-app-token@v2
258+
- name: Checkout with GitHub App
259+
uses: zondax/_actions/checkout-with-app@main
262260
with:
263-
app-id: ${{ secrets.app_id }}
264-
private-key: ${{ secrets.app_pem }}
265-
repositories: ${{ inputs.github_app_repos }}
266-
267-
- name: Checkout repository
268-
uses: actions/checkout@v4
269-
with:
270-
submodules: ${{ inputs.checkout_submodules }}
271-
token: ${{ steps.app-token.outputs.token || github.token }}
272-
273-
- name: Patch git clone
274-
run: sudo git config --system --add safe.directory '*'
261+
github_app_auth: ${{ inputs.github_app_auth }}
262+
github_app_repos: ${{ inputs.github_app_repos }}
263+
checkout_submodules: ${{ inputs.checkout_submodules }}
264+
use_sudo: true
265+
app_id: ${{ secrets.app_id }}
266+
app_pem: ${{ secrets.app_pem }}
275267

276268
- name: Setup Node.js
277269
uses: actions/setup-node@v4
@@ -478,23 +470,15 @@ jobs:
478470
release_id: ${{ steps.release.outputs.id }}
479471

480472
steps:
481-
- name: Generate GitHub App Token
482-
id: app-token
483-
if: inputs.github_app_auth != false
484-
uses: actions/create-github-app-token@v2
473+
- name: Checkout with GitHub App
474+
uses: zondax/_actions/checkout-with-app@main
485475
with:
486-
app-id: ${{ secrets.app_id }}
487-
private-key: ${{ secrets.app_pem }}
488-
repositories: ${{ inputs.github_app_repos }}
489-
490-
- name: Checkout repository
491-
uses: actions/checkout@v4
492-
with:
493-
submodules: ${{ inputs.checkout_submodules }}
494-
token: ${{ steps.app-token.outputs.token || github.token }}
495-
496-
- name: Patch git clone
497-
run: sudo git config --system --add safe.directory '*'
476+
github_app_auth: ${{ inputs.github_app_auth }}
477+
github_app_repos: ${{ inputs.github_app_repos }}
478+
checkout_submodules: ${{ inputs.checkout_submodules }}
479+
use_sudo: true
480+
app_id: ${{ secrets.app_id }}
481+
app_pem: ${{ secrets.app_pem }}
498482

499483
- name: Download all artifacts
500484
uses: actions/download-artifact@v4

.github/workflows/_gen_proto.yaml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,13 @@ jobs:
3434
timeout-minutes: 15
3535

3636
steps:
37-
- name: Generate GitHub App Token
38-
id: app-token
39-
if: inputs.github_app_auth != false
40-
uses: actions/create-github-app-token@v1
37+
- name: Checkout with GitHub App
38+
uses: zondax/_actions/checkout-with-app@main
4139
with:
42-
app-id: ${{ secrets.app_id }}
43-
private-key: ${{ secrets.app_pem }}
44-
repositories: |
45-
${{ inputs.github_app_repos }}
46-
47-
- name: Checkout code
48-
uses: actions/checkout@v4
49-
with:
50-
token: ${{ steps.app-token.outputs.token || github.token }}
40+
github_app_auth: ${{ inputs.github_app_auth }}
41+
github_app_repos: ${{ inputs.github_app_repos }}
42+
app_id: ${{ secrets.app_id }}
43+
app_pem: ${{ secrets.app_pem }}
5144

5245
- name: Install bash and protobuf dependencies
5346
run: |

.github/workflows/_publish-docker.yaml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,27 +50,21 @@ jobs:
5050
id-token: write # Needed for SLSA provenance
5151

5252
steps:
53-
- name: Generate GitHub App Token
54-
id: app-token
55-
if: inputs.github_app_auth != false
56-
uses: actions/create-github-app-token@v1
57-
with:
58-
app-id: ${{ secrets.app_id }}
59-
private-key: ${{ secrets.app_pem }}
60-
repositories: |
61-
${{ inputs.github_app_repos }}
62-
6353
- name: Install deps
6454
run: |
6555
sudo apt-get update -y
6656
sudo apt-get install -yy git make
6757
68-
- name: Checkout
69-
uses: actions/checkout@v4
58+
- name: Checkout with GitHub App
59+
uses: zondax/_actions/checkout-with-app@main
7060
with:
71-
fetch-depth: 0
61+
github_app_auth: ${{ inputs.github_app_auth }}
62+
github_app_repos: ${{ inputs.github_app_repos }}
63+
fetch_depth: 0
7264
ref: ${{ inputs.checkout_ref || github.event.pull_request.head.ref || github.ref }}
73-
token: ${{ steps.app-token.outputs.token || github.token }}
65+
app_id: ${{ secrets.app_id }}
66+
app_pem: ${{ secrets.app_pem }}
67+
use_sudo: true
7468

7569
- name: Debug GitHub variables
7670
run: |

.github/workflows/_publish-npm.yaml

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,15 @@ jobs:
4141
image: node:20-bookworm
4242

4343
steps:
44-
- name: Generate GitHub App Token
45-
id: app-token
46-
if: inputs.github_app_auth != false
47-
uses: actions/create-github-app-token@v1
44+
- name: Checkout with GitHub App
45+
uses: zondax/_actions/checkout-with-app@main
4846
with:
49-
app-id: ${{ secrets.app_id }}
50-
private-key: ${{ secrets.app_pem }}
51-
repositories: |
52-
${{ inputs.github_app_repos }}
53-
54-
- name: Checkout
55-
uses: actions/checkout@v4
56-
with:
57-
fetch-depth: 0 # Perform a deep clone (fetch all history)
58-
submodules: "recursive" # Fetch Git submodules recursively
59-
token: ${{ steps.app-token.outputs.token || github.token }}
60-
61-
# Related to https://github.com/actions/runner/issues/2033
62-
- name: Patch git clone
63-
run: git config --system --add safe.directory '*'
47+
github_app_auth: ${{ inputs.github_app_auth }}
48+
github_app_repos: ${{ inputs.github_app_repos }}
49+
fetch_depth: 0
50+
checkout_submodules: true
51+
app_id: ${{ secrets.app_id }}
52+
app_pem: ${{ secrets.app_pem }}
6453

6554
- name: Install node
6655
uses: actions/setup-node@v4

0 commit comments

Comments
 (0)