Skip to content

Commit 57bf37e

Browse files
committed
Configuring Repos for KB PRs from Support Heroes
1 parent 69ceb4c commit 57bf37e

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/publish-kb.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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: ubuntu-latest
19+
steps:
20+
- name: configure git
21+
run: |
22+
git config --global user.email "[email protected]"
23+
git config --global user.name "KB Bot"
24+
25+
- name: Checkout
26+
uses: actions/checkout@v3
27+
28+
- name: Create branch
29+
run: |
30+
git checkout -b "new-kb-$name-$id"
31+
cd $folder
32+
echo "$content" > "$name.md"
33+
git add "$name.md"
34+
git commit -m "Added new kb article $name"
35+
git push -u origin "new-kb-$name-$id"
36+
env:
37+
name: ${{ github.event.client_payload.name }}
38+
content: ${{ github.event.client_payload.content }}
39+
folder: ${{ github.event.client_payload.folder }}
40+
id: ${{ github.event.client_payload.id }}
41+
42+
- name: Create pull request
43+
run: gh pr create --fill
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)