Skip to content

Commit 2d94d68

Browse files
committed
fix: update workflow for Act Now
1 parent 2124ae5 commit 2d94d68

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

.github/workflows/update_tsvs_now.yml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,31 @@ jobs:
88
runs-on: ubuntu-22.04
99

1010
steps:
11-
# step 1: checkout the repository
11+
# Step 1: Checkout the repository with submodules
1212
- name: Checkout repository
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v3
1414
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
1617

17-
# step 2: setup Python environment
18+
# Step 2: Set up Python environment
1819
- name: Set up Python
1920
uses: actions/setup-python@v2
2021
with:
2122
python-version: '3.10'
2223

23-
# step 3: install dependencies
24+
# Step 3: Install dependencies
2425
- name: Install dependencies
2526
run: |
2627
python -m pip install --upgrade pip
2728
python -m pip install -r requirements.txt
2829
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
3036
- name: Run keyword-based recommendation system
3137
run: python run_kwd_recs.py
3238

@@ -36,15 +42,15 @@ jobs:
3642
- name: Run SPECTER recommendation system
3743
run: python run_spctr_recs.py
3844

39-
# step 5: run the unit tests
45+
# Step 6: Run the unit tests
4046
- name: Run unit tests
4147
run: |
4248
set +e # Continue execution even if the tests fail
4349
python tests.py > tests.log 2>&1
4450
cat tests.log
4551
continue-on-error: true
4652

47-
# step 6: commit and push changes if there are any
53+
# Step 7: Commit and push changes if there are any
4854
- name: Commit and push changes
4955
env:
5056
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -53,6 +59,10 @@ jobs:
5359
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
5460
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
5561
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

Comments
 (0)