Skip to content

Commit d3235b0

Browse files
authored
feat(linkedin): add workflow to post new blogs to LinkedIn (#14)
1 parent 86e4e78 commit d3235b0

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Post New Blog to LinkedIn
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'src/content/blog/**'
9+
schedule:
10+
# 8:15 AM Eastern (15 min after Bluesky to stagger)
11+
- cron: '15 13 * * *'
12+
workflow_dispatch:
13+
inputs:
14+
target_date:
15+
description: 'Date to look for posts (YYYY-MM-DD). Defaults to current date.'
16+
required: false
17+
type: string
18+
19+
jobs:
20+
detect:
21+
uses: CodingWithCalvin/.github/.github/workflows/detect-new-blog-post.yml@main
22+
with:
23+
content_path: 'src/content/blog'
24+
post_filename: 'index.md'
25+
site_url: 'https://www.codingwithcalvin.net'
26+
url_prefix: ''
27+
event_name: ${{ github.event_name }}
28+
categories_field: 'categories'
29+
target_date: ${{ inputs.target_date }}
30+
31+
wait-for-deploy:
32+
needs: detect
33+
if: needs.detect.outputs.has_new_post == 'true' && github.event_name == 'push'
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Wait for Cloudflare deployment
37+
run: |
38+
echo "Waiting 5 minutes for Cloudflare to deploy..."
39+
sleep 300
40+
41+
notify:
42+
needs: [detect, wait-for-deploy]
43+
if: always() && needs.detect.outputs.has_new_post == 'true' && needs.detect.result == 'success'
44+
uses: CodingWithCalvin/.github/.github/workflows/linkedin-post.yml@main
45+
with:
46+
post_text: |
47+
New Blog Post!
48+
49+
${{ needs.detect.outputs.post_title }}
50+
51+
${{ needs.detect.outputs.post_hashtags }}
52+
article_url: ${{ needs.detect.outputs.post_url }}
53+
article_title: ${{ needs.detect.outputs.post_title }}
54+
article_description: ${{ needs.detect.outputs.post_description }}
55+
secrets:
56+
LINKEDIN_ACCESS_TOKEN: ${{ secrets.LINKEDIN_ACCESS_TOKEN }}
57+
LINKEDIN_CLIENT_ID: ${{ secrets.LINKEDIN_CLIENT_ID }}

0 commit comments

Comments
 (0)