Skip to content

Commit

Permalink
We use this microblog for quick updates and announcements about #farm…
Browse files Browse the repository at this point in the history
…OS. If you have something you'd like to share, let us know! https://farmos.discourse.group/t/accepting-suggestions-for-the-microblog/1716
  • Loading branch information
mstenta committed Aug 9, 2023
2 parents 3533e8f + 788b8c3 commit 792e2df
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 11 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/announce-calls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,25 @@ on:
- cron: '0 9 8-14 * *'

jobs:
announce:
build-message:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.MICROBLOG_DEPLOY_KEY }}
- name: Configure Git.
run: |
git config --global user.name 'farmOS'
git config --global user.email '[email protected]'
# We use `date +\%u` below in combination with the schedule cron rules
# above to ensure these only run on the days they are meant to.
- name: Announce calls
- name: Build message
run: |
TZ=UTC
DAY=$(date +\%u)
case "${DAY}" in
3) git commit --allow-empty -m 'The #farmOS monthly community call is today at 2pm Eastern. All are welcome! https://farmos.org/community/monthly-call/' ;;
3) echo "MESSAGE=The #farmOS monthly community call is today at 2pm Eastern. All are welcome! https://farmos.org/community/monthly-call/" >> $GITHUB_ENV ;;
esac
git push origin main
outputs:
message: ${{ env.MESSAGE }}
announce-call:
uses: ./.github/workflows/create-message.yml
needs:
- build-message
if: ${{ needs.build-message.outputs.message }}
with:
message: ${{ needs.build-message.outputs.message }}
secrets: inherit
37 changes: 37 additions & 0 deletions .github/workflows/create-message.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Create message
on:
workflow_call:
inputs:
message:
type: string
required: true
secrets:
MICROBLOG_DEPLOY_KEY:
required: true
workflow_dispatch:
inputs:
message:
description: 'Message to announce'
type: string
required: true

jobs:
create-message:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# Hard-code the repository. This is needed when this workflow is
# triggered using workflow_call from other repositories.
repository: farmOS/farmOS-microblog
ssh-key: ${{ secrets.MICROBLOG_DEPLOY_KEY }}
- name: Configure Git.
run: |
git config --global user.name 'farmOS'
git config --global user.email '[email protected]'
- name: Commit/push to farmOS-microblog.
run: |
git commit --allow-empty --cleanup=whitespace -F- << MESSAGE
${{ inputs.message }}
MESSAGE
git push origin main
3 changes: 3 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Echo message
run: echo ${{ github.event.head_commit.message }}
- name: Mastodon
if: github.repository == 'farmOS/farmOS-microblog'
uses: cbrgm/mastodon-github-action@6cffb7d449201bf36a60589de7a76e18ee226043
with:
message: ${{ github.event.head_commit.message }}
Expand Down

0 comments on commit 792e2df

Please sign in to comment.