Skip to content

Commit ca3e263

Browse files
Merge branch 'main' into ng-arch-peer-test
2 parents 1c7f7f0 + 963b79d commit ca3e263

4 files changed

Lines changed: 153 additions & 28 deletions

File tree

.github/workflows/syntaxCheckPullRequest.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,25 @@ on:
66
jobs:
77
setup-matrix:
88
runs-on: ubuntu-latest
9+
env:
10+
PR_NUMBER: ${{github.event.number}}
11+
912
steps:
1013
- name: Checkout playbooks
1114
uses: actions/checkout@v2
12-
with:
13-
repository: devonfw-tutorials/tutorials
14-
path: playbooks
15-
- id: changedfiles
16-
uses: jitterbit/get-changed-files@v1
15+
- name: Install node environment
16+
uses: actions/setup-node@v2-beta
17+
- name: npm install
18+
run: npm install
19+
- name: Select Changed Files
20+
id: changedfiles
21+
run: |
22+
node selectChangedFiles.js
1723
- name: Setup matrix combinations
1824
id: setup-matrix-combinations
1925
run: |
2026
dirs=()
21-
for changed_file in ${{ steps.changedfiles.outputs.all }}; do
27+
for changed_file in ${{ steps.changedfiles.outputs.changedFiles }}; do
2228
dir="$(echo $changed_file | cut -d/ -f1)"
2329
if [[ ! " ${dirs[@]} " =~ " ${dir} " ]]; then
2430
MATRIX_PARAMS_COMBINATIONS=$MATRIX_PARAMS_COMBINATIONS'{"tutorial": "'$dir'"},'
@@ -55,7 +61,8 @@ jobs:
5561
run: npm install
5662

5763
- name: run buildRun.sh --user ${{ github.actor }} --branch ${{ github.event.pull_request_target.head.ref }} --checkSyntax
58-
run: sh buildRun.sh --user ${{ github.actor }} --branch ${{ github.event.pull_request_target.head.ref }} --checkSyntax -p ${{ matrix.tutorial }} -e test_console
64+
run: |
65+
sh buildRun.sh --user ${{ github.actor }} --branch ${{ github.event.pull_request_target.head.ref }} --checkSyntax -p ${{ matrix.tutorial }} -e test_console
5966
6067
- name: Check error file existence
6168
id: check_files

package-lock.json

Lines changed: 106 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"description": "",
55
"dependencies": {
66
"pegjs": "^0.10.0",
7-
"rimraf": "^3.0.2"
7+
"rimraf": "^3.0.2",
8+
"@octokit/core": "^3.2.3",
9+
"@actions/core": "^1.2.2"
810
},
911
"author": "",
1012
"license": "ISC"

selectChangedFiles.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const core = require("@actions/core");
2+
const { Octokit } = require("@octokit/core");
3+
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
4+
5+
async function selectChangedFiles() {
6+
let pr = process.env.PR_NUMBER;
7+
let arr = [];
8+
try {
9+
let get = await octokit.request('GET /repos/{owner}/{repo}/pulls/{pull_number}/files', {
10+
owner: 'devonfw-tutorials',
11+
repo: 'tutorials',
12+
pull_number: pr
13+
});
14+
let files = get.data;
15+
files.forEach(file => {
16+
arr.push(file.filename)
17+
});
18+
} catch(e) {
19+
throw e;
20+
}
21+
let output = arr.join(' ');
22+
core.info(`Changed Files: ${output}`);
23+
core.setOutput('changedFiles', output);
24+
}
25+
26+
selectChangedFiles().catch(err => {
27+
console.log(err);
28+
process.exit(1);
29+
});
30+

0 commit comments

Comments
 (0)