-
Notifications
You must be signed in to change notification settings - Fork 34
92 lines (78 loc) · 2.91 KB
/
yaml_file.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
90
91
92
name: Check GDS and YAML Files
on:
push:
paths:
- '**/*.gds'
- '**/*.GDS'
- '**/*.oas'
- '**/*.OAS'
pull_request:
paths:
- '**/*.gds'
- '**/*.GDS'
- '**/*.oas'
- '**/*.OAS'
jobs:
check_files:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 2 # Fetch at least the last 2 commits
- name: Get list of changed files
id: changed_files
run: |
echo "Changed files:"
git diff --name-only HEAD~1 > changed_files.txt
cat changed_files.txt
- name: Filter .gds and .oas files
id: design_files
run: |
echo "Design files (.gds, .oas):"
grep -iE '\.(gds|oas)$' changed_files.txt > design_files.txt
cat design_files.txt
- name: Check for corresponding .yaml files
id: yaml_check
run: |
missing_yaml_files=0
missing_files_list=""
while IFS= read -r design_file; do
base_name=$(basename "$design_file" | sed -E 's/\.(gds|oas)$//I')
yaml_file=$(dirname "$design_file")/"$base_name".yaml
if [[ -f "$yaml_file" ]]; then
echo "Found corresponding YAML file for $design_file"
else
echo "Missing YAML file for $design_file"
missing_yaml_files=$((missing_yaml_files + 1))
missing_files_list="$missing_files_list\n- $design_file"
fi
done < design_files.txt
echo "Missing YAML files count: $missing_yaml_files"
echo "missing_yaml_files=$missing_yaml_files" >> $GITHUB_ENV
printf "missing_files_list<<EOF\n$missing_files_list\nEOF" >> $GITHUB_ENV
- name: Create comment if any YAML files are missing
if: env.missing_yaml_files != '0'
uses: actions/github-script@v6
with:
script: |
const missingFilesList = process.env.missing_files_list;
const commentBody = `
### Missing Corresponding YAML Files
The following design files (.gds or .oas) are missing their corresponding .yaml files:
${missingFilesList}
The YAML file is a test sequence format. It's important to think about testing during the design process (Design for Test). Including a test sequence helps ensure that the design can be effectively validated and verified. Please make sure to include the necessary .yaml files to facilitate this.
For more information, refer to the [SiEPIC Testcreator](https://github.com/SiEPIC/SiEPIC_testcreator) repository.
Thank you!
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
- name: Fail if any YAML files are missing
if: env.missing_yaml_files != '0'
run: |
echo "One or more .gds or .oas files are missing corresponding .yaml files"
exit 1