4. Make social media posts from staged content #130
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: 4. Make social media posts from staged content | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 */36 * * *" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check-inbox: | |
runs-on: ubuntu-latest | |
outputs: | |
status: ${{ steps.check.outputs.status }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Check if there are any .yml files in the inbox folder | |
id: check | |
run: | | |
if [ -n "$(find inbox -name '*.yml' -print -quit)" ]; then | |
echo "status=proceed" >> $GITHUB_OUTPUT | |
else | |
echo "status=quit" >> $GITHUB_OUTPUT | |
fi | |
toot-posts: | |
needs: check-inbox | |
if: ${{needs.check-inbox.outputs.status == 'proceed' }} | |
runs-on: ubuntu-20.04 | |
env: | |
MASTODON_TOKEN: ${{ secrets.MASTODON_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: main | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
- name: Install packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install libcurl4-openssl-dev | |
Rscript -e 'install.packages(c("rtoot","yaml"))' | |
- name: Run toot_posts.R | |
run: | | |
Rscript -e "source('scripts/toot_posts.R')" | |
- name: Commit moves | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: moving posted content to outbox |