-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
72 lines (63 loc) · 2.51 KB
/
action.yml
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Initialize variables
description: 'Initialize variables from push, pr, or manual workflow dispatch'
inputs:
full:
type: boolean
description: "Run Full CI Build"
required: false
default: false
outputs:
COMMIT_MESSAGE:
description: "Latest commit message"
value: ${{ steps.setup.outputs.COMMIT_MSG }}
FULL_BUILD:
description: "Whether to do a full build"
value: ${{ steps.setuppush.outputs.FULL_BUILD || steps.setuppr.outputs.FULL_BUILD || steps.setupmanual.outputs.FULL_BUILD }}
runs:
using: 'composite'
steps:
- name: Get Commit Message
shell: bash
run: echo "COMMIT_MSG=$(git log -1 --pretty=%B HEAD | tr '\n' ' ')" >> $GITHUB_ENV
if: ${{ github.event_name == 'push' }}
- name: Get Commit Message
shell: bash
run: echo "COMMIT_MSG=$(git log -1 --pretty=%B HEAD^2 | tr '\n' ' ')" >> $GITHUB_ENV
if: ${{ github.event_name == 'pull_request' }}
- name: Get Commit Message
shell: bash
run: echo "COMMIT_MSG=$(git log -1 --pretty=%B HEAD^2 | tr '\n' ' ')" >> $GITHUB_ENV
if: ${{ github.event_name == 'workflow_dispatch' }}
- name: Display and Setup Build Args (Push)
id: setuppush
shell: bash
run: |
echo "Commit Message: $COMMIT_MSG"
echo "Full Run: $FULL_BUILD"
echo "COMMIT_MSG=$COMMIT_MSG" >> $GITHUB_OUTPUT
echo "FULL_BUILD=$FULL_BUILD" >> $GITHUB_OUTPUT
env:
FULL_BUILD: ${{ startsWith(github.ref_name, 'v') || contains(github.event.head_commit.message, '[ci-full]') || contains(env.COMMIT_MSG, '[ci-full]') }}
if: ${{ github.event_name == 'push' }}
- name: Display and Setup Build Args (PR)
id: setuppr
shell: bash
run: |
echo "Commit Message: $COMMIT_MSG"
echo "Full Run: $FULL_BUILD"
echo "COMMIT_MSG=$COMMIT_MSG" >> $GITHUB_OUTPUT
echo "FULL_BUILD=$FULL_BUILD" >> $GITHUB_OUTPUT
env:
FULL_BUILD: ${{ contains(github.event.pull_request.title, '[ci-full]') || contains(env.COMMIT_MSG, '[ci-full]') }}
if: ${{ github.event_name == 'pull_request' }}
- name: Display and Setup Build Args (Manual)
id: setupmanual
shell: bash
run: |
echo "Commit Message: $COMMIT_MSG"
echo "Full Run: $FULL_BUILD"
echo "COMMIT_MSG=$COMMIT_MSG" >> $GITHUB_OUTPUT
echo "FULL_BUILD=$FULL_BUILD" >> $GITHUB_OUTPUT
env:
FULL_BUILD: ${{ github.event.inputs.ci-full }}
if: ${{ github.event_name == 'workflow_dispatch' }}