Skip to content

Commit

Permalink
Configuring Repos for KB PRs from Support Heroes
Browse files Browse the repository at this point in the history
  • Loading branch information
velikovmartin committed Dec 13, 2023
1 parent 69ceb4c commit 57bf37e
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/publish-kb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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 }}

0 comments on commit 57bf37e

Please sign in to comment.