Fetch Links from Pinboard #3804
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
# .github/workflows/fetch_links.yml | |
name: Fetch Links from Pinboard | |
on: | |
schedule: | |
- cron: '0 * * * *' # Runs every hour | |
workflow_dispatch: # Allows manual triggering of the workflow | |
jobs: | |
fetch-links: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run fetch script | |
run: python blogmarks/pinboard.py | |
env: | |
PINBOARD_API_TOKEN: ${{ secrets.PINBOARD_API_TOKEN }} | |
PINBOARD_API_TAG: ${{ secrets.PINBOARD_API_TAG }} | |
PINBOARD_API_COUNT: ${{ secrets.PINBOARD_API_COUNT }} | |
- name: Check for changes | |
run: git status | |
- name: Commit changes | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add data.db | |
if ! git diff-index --quiet HEAD --; then | |
git commit -m 'Fetch links from Pinboard' | |
git push | |
else | |
echo "No changes to commit." | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |