Update recommendations now #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update recommendations now | |
on: | |
workflow_dispatch: | |
jobs: | |
recompute-recommendations: | |
runs-on: ubuntu-20.04 | |
steps: | |
# step 1: checkout the repository | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
submodules: true # checkout submodules as well | |
# step 2: setup Python environment | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
# step 3: install dependencies | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements.txt | |
# step 4: run recommendation systems | |
- name: Run keyword-based recommendation system | |
run: python run_kwd_recs.py | |
- name: Run BM25 recommendation system | |
run: python run_bm25_recs.py | |
- name: Run SPECTER recommendation system | |
run: python run_spctr_recs.py | |
# step 5: run the unit tests | |
- name: Run unit tests | |
run: | | |
set +e # Continue execution even if the tests fail | |
python tests.py > tests.log 2>&1 | |
cat tests.log | |
continue-on-error: true | |
# step 6: commit and push changes if there are any | |
- name: Commit and push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | |
git add dhq-recs*.tsv | |
git commit -m "feat: update recommendations due to request on ${TIMESTAMP}" | |
git pull --rebase | |
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:main |