Skip to content

Commit

Permalink
Feat: add bot flagging for /bug comment
Browse files Browse the repository at this point in the history
  • Loading branch information
sanggusti committed Aug 22, 2023
1 parent 19801bc commit 90cc6db
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/exercise-ghapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name : exercise-ghapi
on: issue_comment

permissions:
contents: read
issues: write
pull-requests: write

jobs:
ghapi-exercise:
if: (github.event.issue.pull_request != null) && contains(github.event.comment.body, '/bug')
runs-on: ubuntu-latest
steps:
- name: install dependencies
run: pip install ghapi

- name: see payload
run: echo "PAYLOAD:\n${PAYLOAD}\n"
env:
PAYLOAD: ${{ toJson(github.event) }}

- name: Make a comment
shell: python
run: |
import os
from ghapi.core import GhApi
owner,repo = os.environ['REPO'].split('/')
api = GhApi(owner=owner, repo=repo)
api.issues.add_labels(issue_number=os.environ['NUMBER'], labels=['bug'])
env:
NUMBER: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}

0 comments on commit 90cc6db

Please sign in to comment.