Mastodon Welcome Bot #150
This file contains hidden or 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: Mastodon Welcome Bot | |
| on: | |
| schedule: | |
| - cron: "0 2 */2 * *" # 2am UTC every 2 days | |
| workflow_dispatch: # Allows manual triggering | |
| jobs: | |
| welcome-new-users: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Swift | |
| uses: swift-actions/setup-swift@v2 | |
| with: | |
| swift-version: "6.1.0" | |
| - name: Verify Swift Installation | |
| run: swift --version | |
| - name: Run Mastodon Welcome Bot | |
| env: | |
| MASTODON_BASE_URL: ${{ secrets.MASTODON_BASE_URL }} | |
| MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }} | |
| run: swift WelcomeBot.swift | |
| - name: Commit updated timestamp | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add last_check_timestamp.txt | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Update last check timestamp [skip ci]" | |
| git push | |
| fi |