-
Notifications
You must be signed in to change notification settings - Fork 11
45 lines (38 loc) · 1.27 KB
/
publish-kb.yml
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
name: Publish Knowledge Base Article
on:
repository_dispatch:
types: [publish-kb]
run-name: Publish Knowledge Base Article ${{ github.event.client_payload.name }} ${{ github.event.client_payload.id }}
permissions:
contents: write
pull-requests: write
concurrency:
group: '${{ github.workflow }} ${{ github.event.client_payload.id }}'
cancel-in-progress: true
jobs:
publish_kb:
runs-on: ubuntu-latest
steps:
- name: configure git
run: |
git config --global user.email "[email protected]"
git config --global user.name "KB Bot"
- name: Checkout
uses: actions/checkout@v3
- name: Create branch
run: |
git checkout -b "new-kb-$name-$id"
cd $folder
echo "$content" > "$name.md"
git add "$name.md"
git commit -m "Added new kb article $name"
git push -u origin "new-kb-$name-$id"
env:
name: ${{ github.event.client_payload.name }}
content: ${{ github.event.client_payload.content }}
folder: ${{ github.event.client_payload.folder }}
id: ${{ github.event.client_payload.id }}
- name: Create pull request
run: gh pr create --fill
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}