File tree Expand file tree Collapse file tree 1 file changed +66
-0
lines changed Expand file tree Collapse file tree 1 file changed +66
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Verify Constants
2+
3+ on :
4+ push :
5+ paths :
6+ - " chebai/preprocessing/reader.py"
7+ pull_request :
8+ paths :
9+ - " chebai/preprocessing/reader.py"
10+
11+ jobs :
12+ verify-constants :
13+ runs-on : ubuntu-latest
14+
15+ steps :
16+ - name : Checkout code
17+ uses : actions/checkout@v3
18+
19+ - name : Get list of changed files
20+ id : changed_files
21+ run : |
22+ git fetch origin dev
23+
24+ # Get the list of changed files compared to origin/dev and save them to a file
25+ git diff --name-only origin/dev > changed_files.txt
26+
27+ # Print the names of changed files on separate lines
28+ echo "Changed files:"
29+ while read -r line; do
30+ echo "Changed File name : $line"
31+ done < changed_files.txt
32+
33+ - name : Set up Python
34+ uses : actions/setup-python@v4
35+ with :
36+ python-version : ' 3.x'
37+
38+ - name : Export constants
39+ run : python export_constants.py
40+
41+ - name : Load constants into environment variables
42+ id : load_constants
43+ run : |
44+ constants=$(cat constants.json)
45+ echo "$constants" | jq -r 'to_entries|map("export \(.key)=\(.value|tostring)")|.[]' >> $GITHUB_ENV
46+
47+ - name : Verify constants
48+ run : |
49+ if grep -q "chebai/preprocessing/reader.py" changed_files.txt; then
50+ if [ "$EMBEDDING_OFFSET" != "10" ]; then
51+ echo "EMBEDDING_OFFSET does not match expected value!"
52+ exit 1
53+ fi
54+ if [ "$CLS_TOKEN" != "2" ]; then
55+ echo "CLS_TOKEN does not match expected value!"
56+ exit 1
57+ fi
58+ if [ "$PADDING_TOKEN_INDEX" != "0" ]; then
59+ echo "PADDING_TOKEN_INDEX does not match expected value!"
60+ exit 1
61+ fi
62+ if [ "$MASK_TOKEN_INDEX" != "1" ]; then
63+ echo "MASK_TOKEN_INDEX does not match expected value!"
64+ exit 1
65+ fi
66+ fi
You can’t perform that action at this time.
0 commit comments