Repository navigation
43 lines (38 loc) · 1.83 KB
/
Copy pathvalidateBuildRequest.yml
File metadata and controls
43 lines (38 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Validate build request
# Reusable workflow that gates a build before any untrusted App PR code is checked out or build secrets are exposed.
# It mirrors the safeguards testBuild.yml historically ran inline in its `prep` job:
# 1. The dispatching actor must be an Expensify employee with write access.
# 2. The actor must confirm they reviewed the pull request for malicious code (REVIEWED_CODE).
#
# The checks only run for `workflow_dispatch`. On `push` the checked-out code is the pushed commit (already trusted,
# and authored by someone with write access), so the gate is a no-op and downstream jobs proceed.
on:
workflow_call:
inputs:
REVIEWED_CODE:
description: Whether the dispatcher confirmed they reviewed the pull request for malicious code.
type: boolean
required: false
default: false
secrets:
OS_BOTIFY_COMMIT_TOKEN:
description: OSBotify token used to check the actor's repository permissions.
required: true
jobs:
validate:
name: Validate build request
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- name: Checkout
uses: useblacksmith/checkout@0647fdbab2614a5eb86d2971070e325060d91056 # v1.7.0
- name: Validate that user is an Expensify employee
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: ./.github/actions/composite/validateActor
with:
REQUIRE_APP_DEPLOYER: false
OS_BOTIFY_TOKEN: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }}
- name: Validate that the user reviewed the pull request before running a build
if: ${{ github.event_name == 'workflow_dispatch' && !inputs.REVIEWED_CODE }}
run: |
echo "::error::🕵️♀️ Please carefully review the pull request before running a build to ensure it does not contain any malicious code"
exit 1