-
Notifications
You must be signed in to change notification settings - Fork 99
66 lines (53 loc) · 1.99 KB
/
check_gds_files.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
name: Check GDS and OAS File Submissions
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
check_files:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch all branches
run: git fetch --all
- name: Get list of changed files
id: changed_files
run: |
FILES=$(git diff --name-only --diff-filter=ACM origin/${{ github.base_ref }}...HEAD)
echo "files=$FILES" >> $GITHUB_ENV
- name: Debug changed files
run: |
echo "Changed files: ${{ env.files }}"
- name: Debug File Paths
run: |
echo "Files detected: ${{ env.files }}"
mapfile -t file_array <<< "${{ env.files }}"
for file in "${file_array[@]}"; do
echo "Checking file: '$file'"
done
shell: bash
- name: Check GDS and OAS file locations and names
run: |
changed_files="${{ env.files }}"
# Convert newline-separated string into an array
mapfile -t file_array <<< "$changed_files"
for file in "${file_array[@]}"; do
trimmed_file=$(echo "$file" | tr -d '[:space:]') # Trim spaces/newlines
abs_path=$(realpath "$trimmed_file")
if [[ "$trimmed_file" == *.gds || "$trimmed_file" == *.oas ]]; then
if [[ "$trimmed_file" != submissions/* ]]; then
echo "Error: File '$trimmed_file' is not in the 'submissions' folder."
exit 1
fi
if [[ "$trimmed_file" == *" "* ]]; then
echo "Error: File '$trimmed_file' contains spaces in the filename."
exit 1
fi
fi
done
shell: bash
- name: Success message
if: success()
run: echo "All GDS and OAS files are correctly placed in the submissions folder and contain no spaces in their filenames."