-
Notifications
You must be signed in to change notification settings - Fork 1.2k
39 lines (39 loc) · 1.4 KB
/
resolve-args.yaml
File metadata and controls
39 lines (39 loc) · 1.4 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
name: ResolveArgs
on:
workflow_call:
inputs:
allowed_comment:
type: string
required: true
outputs:
SHOULD_RUN:
value: ${{ jobs.resolve.outputs.SHOULD_RUN }}
GIT_REF:
value: ${{ jobs.resolve.outputs.GIT_REF }}
jobs:
resolve:
runs-on: ubuntu-latest
outputs:
SHOULD_RUN: ${{ steps.resolve-step.outputs.SHOULD_RUN }}
GIT_REF: ${{ steps.resolve-step.outputs.GIT_REF }}
steps:
# Download the artifact and resolve the commit if initiated by PR snapshot
# Otherwise, use the currently checked-out branch to run the E2E tests against
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- if: github.event_name == 'workflow_run'
uses: ./.github/actions/download-artifact
- id: resolve-step
env:
ALLOWED_COMMENT: ${{ inputs.allowed_comment }}
run: |
if [[ "${{ github.event_name }}" == "workflow_run" ]]; then
if [[ "$(head -n 1 /tmp/artifacts/metadata.txt)" == *"$ALLOWED_COMMENT"* ]]; then
echo SHOULD_RUN=true >> "$GITHUB_OUTPUT"
else
echo SHOULD_RUN=false >> "$GITHUB_OUTPUT"
fi
echo GIT_REF="$(tail -n 1 /tmp/artifacts/metadata.txt)" >> "$GITHUB_OUTPUT"
else
echo SHOULD_RUN=true >> "$GITHUB_OUTPUT"
echo GIT_REF="" >> "$GITHUB_OUTPUT"
fi