Skip to content

[CERT C Review Batch 2/5] Review proposed Rust categorization #209

[CERT C Review Batch 2/5] Review proposed Rust categorization

[CERT C Review Batch 2/5] Review proposed Rust categorization #209

name: Reviewer Bot Issue Comment Direct
on:
issue_comment:
types: [created]
permissions:
contents: read
env:
STATE_ISSUE_NUMBER: '314'
jobs:
reviewer-bot-issue-comment-direct:
if: ${{ github.event.issue.pull_request == null }}
runs-on: ubuntu-latest
permissions:
# Temporary lock debt: contents:write is allowed only for the existing lock-ref API operations.
contents: write
issues: write
pull-requests: write
actions: read
steps:
- name: Install uv
run: python -m pip install uv
- name: Fetch trusted bot source tarball
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python - <<'PY'
import io, os, tarfile, urllib.request
from pathlib import Path
repo = os.environ['GITHUB_REPOSITORY']
ref = os.environ['GITHUB_SHA']
req = urllib.request.Request(
f'https://api.github.com/repos/{repo}/tarball/{ref}',
headers={'Authorization': f"Bearer {os.environ['GITHUB_TOKEN']}", 'Accept': 'application/vnd.github+json'},
)
target = Path(os.environ['RUNNER_TEMP']) / 'reviewer-bot-src'
target.mkdir(parents=True, exist_ok=True)
with urllib.request.urlopen(req) as response:
data = response.read()
with tarfile.open(fileobj=io.BytesIO(data), mode='r:gz') as archive:
archive.extractall(target)
roots = list(target.iterdir())
print(f'BOT_SRC_ROOT={roots[0]}', file=open(os.environ['GITHUB_ENV'], 'a', encoding='utf-8'))
PY
- name: Run reviewer bot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EVENT_NAME: issue_comment
EVENT_ACTION: created
ISSUE_NUMBER: ${{ github.event.issue.number }}
ISSUE_STATE: ${{ github.event.issue.state }}
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_AUTHOR: ${{ github.event.issue.user.login }}
ISSUE_HTML_URL: ${{ github.event.issue.html_url }}
ISSUE_LABELS: ${{ toJson(github.event.issue.labels.*.name) }}
COMMENT_BODY: ${{ github.event.comment.body }}
COMMENT_AUTHOR: ${{ github.event.comment.user.login }}
COMMENT_ID: ${{ github.event.comment.id }}
COMMENT_CREATED_AT: ${{ github.event.comment.created_at }}
COMMENT_USER_TYPE: ${{ github.event.comment.user.type }}
COMMENT_AUTHOR_ASSOCIATION: ${{ github.event.comment.author_association }}
COMMENT_SENDER_TYPE: ${{ github.event.sender.type }}
COMMENT_INSTALLATION_ID: ${{ github.event.installation.id }}
COMMENT_PERFORMED_VIA_GITHUB_APP: ${{ github.event.comment.performed_via_github_app != null }}
REPO_OWNER: ${{ github.repository_owner }}
REPO_NAME: ${{ github.event.repository.name }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_REF: ${{ github.ref }}
WORKFLOW_RUN_ID: ${{ github.run_id }}
WORKFLOW_NAME: ${{ github.workflow }}
WORKFLOW_JOB_NAME: ${{ github.job }}
CURRENT_WORKFLOW_FILE: .github/workflows/reviewer-bot-issue-comment-direct.yml
run: uv run --project "$BOT_SRC_ROOT" reviewer-bot