Skip to content

Commit

Permalink
chore: create docs issue for needs docs label (#3153)
Browse files Browse the repository at this point in the history
* chore: create docs issue for needs docs label

Signed-off-by: Mark Phelps <[email protected]>

* chore: rename workflow; check for existing issues

Signed-off-by: Mark Phelps <[email protected]>

* chore: rm renamed file

Signed-off-by: Mark Phelps <[email protected]>

---------

Signed-off-by: Mark Phelps <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
markphelps and kodiakhq[bot] authored Jun 7, 2024
1 parent 9d4a6ef commit bd15e53
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Label PRs

on:
pull_request:
types: [labeled]
branches:
- main

jobs:
create-docs-issue:
if: github.event.label.name == 'needs docs'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.FLIPT_RELEASE_BOT_APP_ID }}
private_key: ${{ secrets.FLIPT_RELEASE_BOT_APP_PEM }}
installation_id: ${{ secrets.FLIPT_RELEASE_BOT_INSTALLATION_ID }}

- name: Check for existing issues
id: check-issues
env:
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
run: |
pr_title=$(jq -r .pull_request.title < $GITHUB_EVENT_PATH)
issue_title="Document: $pr_title"
existing_issue=$(gh issue list --repo ${{ github.repository_owner }}/docs --search "$issue_title" --json title --jq '.[0].title')
echo "::set-output name=issue_exists::$existing_issue"
- name: Create documentation issue
if: steps.check-issues.outputs.issue_exists == ''
env:
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
run: |
pr_title=$(jq -r .pull_request.title < $GITHUB_EVENT_PATH)
pr_url=$(jq -r .pull_request.html_url < $GITHUB_EVENT_PATH)
issue_title="Document: $pr_title"
issue_body="This issue was created to document the following pull request: $pr_url"
gh issue create --title "$issue_title" --body "$issue_body" --repo ${{ github.repository_owner }}/docs

0 comments on commit bd15e53

Please sign in to comment.