Skip to content
Closed
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
15 changes: 11 additions & 4 deletions .github/workflows/pr-comment-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ jobs:
fetch-depth: 1
- name: Fetch PR head for metadata
# Make the PR commit available so the bot can read its build.toml (data only).
run: git fetch --depth=1 origin "refs/pull/${{ github.event.issue.number }}/head"
env:
PR_NUMBER: ${{ github.event.issue.number }}
run: |
if ! printf '%s' "$PR_NUMBER" | grep -Eq '^[0-9]+$'; then
echo "Invalid PR number"
exit 1
fi
git fetch --depth=1 origin "refs/pull/${PR_NUMBER}/head"
- name: Handle /kernel-bot command
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -37,7 +44,7 @@ jobs:
set -eu
if [ "${#COMMENT_BODY}" -gt 1024 ]; then
echo "Ignoring oversized comment payload."
exit 0
exit 1
fi
case "$COMMENT_BODY" in
/kernel-bot*) ;;
Expand All @@ -48,10 +55,10 @@ jobs:
esac
if ! printf '%s' "$COMMENT_BODY" | grep -Eq '^/kernel-bot[][ A-Za-z0-9_,./-]*$'; then
echo "Ignoring /kernel-bot comment with unsupported characters."
exit 0
exit 1
fi
if [[ "$COMMENT_AUTHOR_ASSOCIATION" != "MEMBER" && "$COMMENT_AUTHOR_ASSOCIATION" != "OWNER" && "$COMMENT_AUTHOR_ASSOCIATION" != "COLLABORATOR" ]]; then
echo "Unauthorized: Only members, owners, and collaborators can use /kernel-bot."
exit 0
exit 1
fi
python3 .github/scripts/pr_comment_kernel_bot.py