-
Notifications
You must be signed in to change notification settings - Fork 839
37 lines (37 loc) · 1.3 KB
/
resolve-args.yaml
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
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@v4
- if: github.event_name == 'workflow_run'
uses: ./.github/actions/download-artifact
- id: resolve-step
run: |
if [[ "${{ github.event_name }}" == "workflow_run" ]]; then
if [[ "$(head -n 1 /tmp/artifacts/metadata.txt)" == *"${{ inputs.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