-
Notifications
You must be signed in to change notification settings - Fork 37
89 lines (87 loc) · 3.24 KB
/
syntaxCheckPullRequest.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Check PR Katacoda Syntax
env:
PR_NUMBER: ${{github.event.number}}
on:
pull_request_target:
branches: [ main ]
jobs:
setup-matrix:
runs-on: ubuntu-latest
steps:
- name: Checkout playbooks
uses: actions/checkout@v2
- name: Install node environment
uses: actions/setup-node@v2-beta
with:
node-version: '12'
- name: npm install
run: npm install
- name: Select Changed Files
id: changedfiles
run: node selectChangedFiles.js
- name: Get Playbook Checkout
id: get_checkout
run: node getPlaybookCheckout.js
- name: Setup matrix combinations
id: setup-matrix-combinations
run: |
dirs=()
for changed_file in ${{ steps.changedfiles.outputs.changedFiles }}; do
dir="$(echo $changed_file | cut -d/ -f1)"
if [[ ! " ${dirs[@]} " =~ " ${dir} " ]]; then
MATRIX_PARAMS_COMBINATIONS=$MATRIX_PARAMS_COMBINATIONS'{"tutorial": "'$dir'"},'
fi
dirs+=($dir)
done
echo ::set-output name=matrix-combinations::{\"include\":[$MATRIX_PARAMS_COMBINATIONS]}
outputs:
matrix-combinations: ${{ steps.setup-matrix-combinations.outputs.matrix-combinations }}
checkout_ref: ${{ steps.get_checkout.outputs.ref}}
checkout_name: ${{ steps.get_checkout.outputs.name}}
build:
runs-on: ubuntu-latest
needs: setup-matrix
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix-combinations) }}
steps:
- name: Checkout tutorial-compiler
uses: actions/checkout@v2
with:
repository: devonfw-tutorials/tutorial-compiler
- name: Checkout playbooks
uses: actions/checkout@v2
with:
repository: ${{needs.setup-matrix.outputs.checkout_name}}/tutorials
ref: ${{needs.setup-matrix.outputs.checkout_ref}}
path: playbooks
- uses: actions/setup-node@v2-beta
with:
node-version: '12'
- name: install TS
run: npm install typescript
- name: npm install
run: npm install
- name: run buildRun.sh --user ${{ github.actor }} --branch ${{needs.setup-matrix.outputs.checkout_ref}} --checkSyntax
run: sh buildRun.sh --user ${{ github.actor }} --branch ${{needs.setup-matrix.outputs.checkout_ref}} --checkSyntax -p ${{ matrix.tutorial }} -e test_console
- name: Check error file existence
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "./build/errors/syntaxErrors.md"
- name: Get message
id: get_message
if: steps.check_files.outputs.files_exists == 'true'
run: |
message=`cat ./build/errors/syntaxErrors.md`
message="${message//'%'/'%25'}"
message="${message//$'\n'/'%0A'}"
message="${message//$'\r'/'%0D'}"
echo "${message}"
echo "::set-output name=message::$message"
- name: Request changes
if: ${{ steps.get_message.outputs.message != '' }}
uses: andrewmusgrave/[email protected]
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
event: COMMENT
body: ${{ steps.get_message.outputs.message }}