|
1 | 1 | name: Post New Blog to Bluesky |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: |
6 | | - - main |
7 | | - paths: |
8 | | - - 'src/content/blog/**' |
| 4 | + workflow_run: |
| 5 | + workflows: ["Scheduled Deploy"] |
| 6 | + types: |
| 7 | + - completed |
9 | 8 | schedule: |
10 | 9 | # 8 AM Eastern: 13:00 UTC (EST) / 12:00 UTC (EDT) |
11 | 10 | # Using 13:00 UTC = 8 AM EST, 9 AM EDT |
|
18 | 17 | type: string |
19 | 18 |
|
20 | 19 | jobs: |
21 | | - detect: |
22 | | - uses: CodingWithCalvin/.github/.github/workflows/detect-new-blog-post.yml@main |
23 | | - with: |
24 | | - content_path: 'src/content/blog' |
25 | | - post_filename: 'index.md' |
26 | | - site_url: 'https://www.codingwithcalvin.net' |
27 | | - url_prefix: '' |
28 | | - event_name: ${{ github.event_name }} |
29 | | - categories_field: 'categories' |
30 | | - target_date: ${{ inputs.target_date }} |
31 | | - |
32 | | - wait-for-deploy: |
33 | | - needs: detect |
34 | | - if: needs.detect.outputs.has_new_post == 'true' && github.event_name == 'push' |
| 20 | + check-trigger: |
35 | 21 | runs-on: ubuntu-latest |
| 22 | + outputs: |
| 23 | + should_continue: ${{ steps.check.outputs.should_continue }} |
36 | 24 | steps: |
37 | | - - name: Wait for Cloudflare deployment |
| 25 | + - name: Check if we should continue |
| 26 | + id: check |
38 | 27 | run: | |
39 | | - echo "Waiting 5 minutes for Cloudflare to deploy..." |
40 | | - sleep 300 |
| 28 | + if [ "${{ github.event_name }}" == "workflow_run" ]; then |
| 29 | + if [ "${{ github.event.workflow_run.conclusion }}" != "success" ]; then |
| 30 | + echo "Scheduled Deploy failed, skipping" |
| 31 | + echo "should_continue=false" >> $GITHUB_OUTPUT |
| 32 | + exit 0 |
| 33 | + fi |
| 34 | + fi |
| 35 | + echo "should_continue=true" >> $GITHUB_OUTPUT |
| 36 | +
|
| 37 | + detect: |
| 38 | + needs: check-trigger |
| 39 | + if: needs.check-trigger.outputs.should_continue == 'true' |
| 40 | + uses: CodingWithCalvin/.github/.github/workflows/detect-blog-post-from-rss.yml@main |
| 41 | + with: |
| 42 | + rss_url: 'https://www.codingwithcalvin.net/rss.xml' |
| 43 | + target_date: ${{ inputs.target_date }} |
41 | 44 |
|
42 | 45 | notify: |
43 | | - needs: [detect, wait-for-deploy] |
44 | | - if: always() && needs.detect.outputs.has_new_post == 'true' && needs.detect.result == 'success' |
| 46 | + needs: detect |
| 47 | + if: needs.detect.outputs.has_posts == 'true' |
45 | 48 | uses: CodingWithCalvin/.github/.github/workflows/bluesky-post.yml@main |
46 | 49 | with: |
47 | 50 | post_text: | |
48 | | - 📝 New Blog Post! |
| 51 | + New Blog Post! |
49 | 52 |
|
50 | 53 | [${{ needs.detect.outputs.post_title }}](${{ needs.detect.outputs.post_url }}) |
51 | 54 |
|
|
0 commit comments