-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
70 lines (65 loc) · 2.23 KB
/
action.yml
File metadata and controls
70 lines (65 loc) · 2.23 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
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
name: 'Initialize Action'
description: 'Sets up the environment, cancels previous runs, and generates a project matrix'
branding:
icon: 'chevron-right'
color: 'gray-dark'
inputs:
project-root:
description: 'Project root folder'
required: false
default: '.'
script-version:
description: 'Script version'
required: false
default: '0.5.1'
outputs:
matrix:
description: "The project matrix for subsequent jobs"
value: ${{ steps.setmatrix.outputs.matrix }}
files:
description: "List of changed files"
value: ${{ steps.files.outputs.all_changed_files }}
runs:
using: "composite"
steps:
- name: Cancel Previous Runs
if: ${{ github.ref != 'refs/heads/develop' && github.ref != 'refs/heads/main' }}
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Download Scripts
shell: bash
run: |
mkdir -p .github/actions
cd .github/actions
wget https://github.com/robaone/initialize-action/archive/refs/tags/v${{ inputs.script-version }}.zip -O scripts.zip
- name: Unzip scripts
shell: bash
run: |
unzip scripts.zip '*/scripts/*.sh'
rm scripts.zip
working-directory: .github/actions
- id: files
uses: tj-actions/changed-files@v45.0.0
- name: List files modified
id: project_list
shell: bash
run: |
echo ${{ steps.files.outputs.all_changed_files }} | sed -E 's/ /\n/g' > modified_files.txt
echo "## Modified Files"
cat modified_files.txt
cat modified_files.txt | .github/actions/initialize-action-${{ inputs.script-version }}/scripts/parse_file_list_for_projects.sh > project_list.txt
env:
PROJECT_ROOT: ${{ inputs.project-root }}
- name: Set Dynamic Matrix
id: setmatrix
shell: bash
run: |
echo "## Project List"
cat project_list.txt
matrixStringifiedObject="$(cat project_list.txt | .github/actions/initialize-action-${{ inputs.script-version }}/scripts/generate_matrix.sh)"
echo "## Matrix Object"
echo "$matrixStringifiedObject"
echo "matrix=$matrixStringifiedObject" >> $GITHUB_OUTPUT
env:
PROJECT_ROOT: ${{ inputs.project-root }}