Skip to content

Commit 17d8af3

Browse files
committed
(chore) add publish-kb.yml workflow
1 parent 3b29dbd commit 17d8af3

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/publish-kb.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Publish Knowledge Base Article
2+
on:
3+
repository_dispatch:
4+
types: [publish-kb]
5+
6+
run-name: Publish Knowledge Base Article ${{ github.event.client_payload.name }} ${{ github.event.client_payload.id }}
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
concurrency:
13+
group: '${{ github.workflow }} ${{ github.event.client_payload.id }}'
14+
cancel-in-progress: true
15+
16+
jobs:
17+
publish_kb:
18+
runs-on: windows-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v3
22+
23+
- name: configure git
24+
run: |
25+
git config --global user.email "[email protected]"
26+
git config --global user.name "KB Bot"
27+
- name: Create branch
28+
run: |
29+
git checkout -b "new-kb-$($env:name)-$($env:id)"
30+
cd $env:folder
31+
echo $env:content > "$($env:name).md"
32+
git add "$($env:name).md"
33+
git commit -m "Added new kb article $($env:name)"
34+
git push -u origin "new-kb-$($env:name)-$($env:id)"
35+
env:
36+
name: ${{ github.event.client_payload.name }}
37+
content: ${{ github.event.client_payload.content }}
38+
folder: ${{ github.event.client_payload.folder }}
39+
id: ${{ github.event.client_payload.id }}
40+
41+
- name: Create pull request
42+
run: gh pr create --fill
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)