Post New Blog to Bluesky #16
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: Post New Blog to Bluesky | |
| on: | |
| workflow_run: | |
| workflows: ["Scheduled Deploy"] | |
| types: | |
| - completed | |
| schedule: | |
| # 8 AM Eastern: 13:00 UTC (EST) / 12:00 UTC (EDT) | |
| # Using 13:00 UTC = 8 AM EST, 9 AM EDT | |
| - cron: '0 13 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| target_date: | |
| description: 'Date to look for posts (YYYY-MM-DD). Defaults to current date.' | |
| required: false | |
| type: string | |
| jobs: | |
| check-trigger: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_continue: ${{ steps.check.outputs.should_continue }} | |
| steps: | |
| - name: Check if we should continue | |
| id: check | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_run" ]; then | |
| if [ "${{ github.event.workflow_run.conclusion }}" != "success" ]; then | |
| echo "Scheduled Deploy failed, skipping" | |
| echo "should_continue=false" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| fi | |
| echo "should_continue=true" >> $GITHUB_OUTPUT | |
| detect: | |
| needs: check-trigger | |
| if: needs.check-trigger.outputs.should_continue == 'true' | |
| uses: CodingWithCalvin/.github/.github/workflows/detect-blog-post-from-rss.yml@main | |
| with: | |
| rss_url: 'https://www.codingwithcalvin.net/rss.xml' | |
| target_date: ${{ inputs.target_date }} | |
| notify: | |
| needs: detect | |
| if: needs.detect.outputs.has_posts == 'true' | |
| uses: CodingWithCalvin/.github/.github/workflows/bluesky-post.yml@main | |
| with: | |
| post_text: | | |
| New Blog Post! | |
| [${{ needs.detect.outputs.post_title }}](${{ needs.detect.outputs.post_url }}) | |
| ${{ needs.detect.outputs.post_hashtags }} | |
| embed_url: ${{ needs.detect.outputs.post_url }} | |
| embed_title: ${{ needs.detect.outputs.post_title }} | |
| embed_description: ${{ needs.detect.outputs.post_description }} | |
| secrets: | |
| BLUESKY_USERNAME: ${{ secrets.BLUESKY_USERNAME }} | |
| BLUESKY_APP_PASSWORD: ${{ secrets.BLUESKY_APP_PASSWORD }} |