website-toots/.github/workflows/refresh.yml
Brandon Rozek bc01b85f87
Rust implementation
TODO: Make sure that JSON file writes are equivalent for less commit noise
2024-07-07 21:20:50 -07:00

50 lines
1.1 KiB
YAML

name: Sync Toots from Mastodon
on:
workflow_dispatch:
schedule:
- cron: "12 23 * * *"
defaults:
run:
shell: bash
jobs:
build_and_sync:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Install Rust
run: |
sudo apt update
sudo apt install -y rustc cargo
- name: Build
run: |
cd .scripts
cargo build --release
- name: Retrieve toots
run: |
cd .scripts
./target/release/retrieve_toots
- name: Check if there's any changes
id: verify_diff
run: |
if [ -n "$(git status --porcelain)" ]; then echo ::set-output name=changed::true; fi
- name: Commit and push
if: steps.verify_diff.outputs.changed == 'true'
run: |
git add .data
git commit -m "New/Modified Toots"
git push origin main