8
8
runs-on : ubuntu-22.04
9
9
10
10
steps :
11
- # step 1: checkout the repository
11
+ # Step 1: Checkout the repository with submodules
12
12
- name : Checkout repository
13
- uses : actions/checkout@v2
13
+ uses : actions/checkout@v3
14
14
with :
15
- submodules : true # checkout submodules as well
15
+ submodules : recursive # Checkout submodules recursively
16
+ fetch-depth : 0 # Fetch full history to ensure submodules are up to date
16
17
17
- # step 2: setup Python environment
18
+ # Step 2: Set up Python environment
18
19
- name : Set up Python
19
20
uses : actions/setup-python@v2
20
21
with :
21
22
python-version : ' 3.10'
22
23
23
- # step 3: install dependencies
24
+ # Step 3: Install dependencies
24
25
- name : Install dependencies
25
26
run : |
26
27
python -m pip install --upgrade pip
27
28
python -m pip install -r requirements.txt
28
29
29
- # step 4: run recommendation systems
30
+ # Step 4: Update submodules to the latest commit
31
+ - name : Update submodules to latest
32
+ run : |
33
+ git submodule foreach 'git fetch origin main && git checkout origin/main && git pull origin main'
34
+
35
+ # Step 5: Run recommendation systems
30
36
- name : Run keyword-based recommendation system
31
37
run : python run_kwd_recs.py
32
38
@@ -36,15 +42,15 @@ jobs:
36
42
- name : Run SPECTER recommendation system
37
43
run : python run_spctr_recs.py
38
44
39
- # step 5: run the unit tests
45
+ # Step 6: Run the unit tests
40
46
- name : Run unit tests
41
47
run : |
42
48
set +e # Continue execution even if the tests fail
43
49
python tests.py > tests.log 2>&1
44
50
cat tests.log
45
51
continue-on-error : true
46
52
47
- # step 6: commit and push changes if there are any
53
+ # Step 7: Commit and push changes if there are any
48
54
- name : Commit and push changes
49
55
env :
50
56
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
53
59
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
54
60
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
55
61
git add dhq-recs*.tsv
56
- git commit -m "feat: update recommendations due to request on ${TIMESTAMP}"
57
- git pull --rebase
58
- git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:main
62
+ git add dhq-journal
63
+ if [ -n "$(git status --porcelain)" ]; then
64
+ git commit -m "feat: update recommendations due to request on ${TIMESTAMP}"
65
+ git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:main
66
+ else
67
+ echo "No changes to commit"
68
+ fi
0 commit comments