Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add bot flagging for /bug comment #3

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}