Capture, update and post latest formula #355
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: Capture, update and post latest formula | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: 30 12 * * * | |
| jobs: | |
| capture-update-post: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out this repo | |
| uses: actions/checkout@v4 | |
| - name: Setup Python environment | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| version: 0.5.21 | |
| enable-cache: true | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Fetch latest formula data | |
| run: uv run homebrew-new-bot api formula | |
| - name: Restore formula database from plaintext | |
| run: uv run homebrew-new-bot database restore formula | |
| - name: Update formula database via API | |
| run: uv run homebrew-new-bot database update formula | |
| - name: Dump database back to plaintext | |
| run: uv run homebrew-new-bot database dump formula | |
| - name: Post new formula to mastodon | |
| run: uv run homebrew-new-bot toot --max_toots_per_execution=${{ vars.MAX_TOOTS_PER_EXECUTION }} --mastodon_api_base_url=${{ vars.MASTODON_API_BASE_URL }} --mastodon_access_token=${{ secrets.MASTODON_ACCESS_TOKEN }} --mastodon_client_secret=${{ secrets.MASTODON_CLIENT_SECRET }} formula | |
| - name: Post new formula to bsky | |
| if: ${{ always() }} | |
| run: uv run homebrew-new-bot skeet --max_skeets_per_execution=${{ vars.MAX_SKEETS_PER_EXECUTION }} --bsky_username=${{ vars.BSKY_USERNAME }} --bsky_password=${{ secrets.BSKY_PASSWORD }} formula | |
| - name: Commit any changes to state | |
| if: ${{ always() }} | |
| run: |- | |
| git config user.name "Automated" | |
| git config user.email "actions@users.noreply.github.com" | |
| git add -A | |
| timestamp=$(date -u) | |
| git commit -m "Latest state: ${timestamp}" || exit 0 | |
| git push |