-
Notifications
You must be signed in to change notification settings - Fork 959
54 lines (44 loc) · 1.28 KB
/
publish-article.yml
File metadata and controls
54 lines (44 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Publish Blog Article
on:
workflow_dispatch:
inputs:
payload:
description: "JSON payload from webhook"
required: true
permissions:
contents: write
jobs:
publish-article:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
ref: ${{ github.head_ref }}
- uses: pnpm/action-setup@v4
with:
version: 9.15.0
run_install: false
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Save payload
run: node -e "require('fs').writeFileSync('payload.json', process.env.PAYLOAD)"
env:
PAYLOAD: ${{ github.event.inputs.payload }}
- name: Write blog posts
run: node .github/scripts/publish-articles.cjs
- name: Delete payload
run: rm -f payload.json
- name: Format code
run: pnpm format:fix
- name: Commit & push
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Add blog article from webhook" || echo "No changes"
git push