Skip to content

Commit e73376e

Browse files
committed
Merge branch 'main' into docs/update-template-script-usage
2 parents 2236e14 + 8aaee44 commit e73376e

235 files changed

Lines changed: 75853 additions & 39491 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Reviewer Bot Source
2+
description: Select the trusted checked-out reviewer-bot source root.
3+
outputs:
4+
bot-src-root:
5+
description: Absolute path to the trusted reviewer-bot source checkout.
6+
value: ${{ steps.source-root.outputs.bot-src-root }}
7+
runs:
8+
using: composite
9+
steps:
10+
- id: source-root
11+
shell: bash
12+
run: |
13+
workspace_root="$(git -C "$GITHUB_WORKSPACE" rev-parse --show-toplevel)"
14+
if [ "$workspace_root" != "$GITHUB_WORKSPACE" ]; then
15+
echo "reviewer-bot source checkout root does not match GITHUB_WORKSPACE" >&2
16+
exit 1
17+
fi
18+
checked_out_sha="$(git -C "$GITHUB_WORKSPACE" rev-parse HEAD)"
19+
if [ -n "${GITHUB_SHA:-}" ] && [ "$checked_out_sha" != "$GITHUB_SHA" ]; then
20+
echo "reviewer-bot source checkout does not match GITHUB_SHA" >&2
21+
exit 1
22+
fi
23+
remote_url="$(git -C "$GITHUB_WORKSPACE" config --get remote.origin.url || true)"
24+
case "$remote_url" in
25+
*"$GITHUB_REPOSITORY"*) ;;
26+
*)
27+
echo "reviewer-bot source checkout remote does not match GITHUB_REPOSITORY" >&2
28+
exit 1
29+
;;
30+
esac
31+
if [ ! -f "$GITHUB_WORKSPACE/scripts/reviewer_bot.py" ]; then
32+
echo "reviewer-bot source checkout is missing scripts/reviewer_bot.py" >&2
33+
exit 1
34+
fi
35+
bot_entry="$(realpath "$GITHUB_WORKSPACE/scripts/reviewer_bot.py")"
36+
if [ "$bot_entry" != "$GITHUB_WORKSPACE/scripts/reviewer_bot.py" ]; then
37+
echo "reviewer-bot entrypoint must be a regular file inside the trusted checkout" >&2
38+
exit 1
39+
fi
40+
printf 'bot-src-root=%s\n' "$GITHUB_WORKSPACE" >> "$GITHUB_OUTPUT"
41+
printf 'BOT_SRC_ROOT=%s\n' "$GITHUB_WORKSPACE" >> "$GITHUB_ENV"

0 commit comments

Comments
 (0)