Skip to content

Testing bug flagging #1

Testing bug flagging

Testing bug flagging #1

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 }}