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