Upload New Zotero Links #137
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: Upload New Zotero Links | |
on: | |
schedule: | |
- cron: "0 0 */3 * *" | |
# runs every 3 days at midnight | |
workflow_dispatch: | |
jobs: | |
report: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: install dependencies | |
run: pip install -r src/requirements.txt | |
- name: Run script for updating files | |
working-directory: ./src | |
env: | |
LIBRARY_ID: '${{ secrets.LIBRARY_ID }}' | |
API_KEY: '${{ secrets.API_KEY }}' | |
USER_TYPE: '${{ secrets.USER_TYPE }}' | |
run: | | |
python3 zot.py | |
shell: bash | |
- name: Save Time | |
run: | | |
echo "TIME=$(TZ=America/Los_Angeles date +'%m/%d/%Y %H:%M %Z')" >> $GITHUB_ENV | |
- name: Check if there are any changes | |
id: verify_diff | |
run: | | |
git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT | |
- name: Add and commit files | |
if: steps.verify_diff.outputs.changed == 'true' | |
run: | | |
git config --local user.email ${{ secrets.EMAIL }} | |
git config --local user.name ${{ secrets.NAME }} | |
git add --all | |
git commit -m "adding new saved links on ${{ env.TIME }}" | |
- name: GitHub Push | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main |