[size-report] checkout pull request head (#11724)

This commit is contained in:
Yakun Xu
2025-07-15 10:48:46 -07:00
committed by GitHub
parent e72e68a05e
commit d4734df8bb
3 changed files with 15 additions and 2 deletions
+6 -1
View File
@@ -53,9 +53,14 @@ jobs:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Checkout Pull Request
if: ${{ github.event_name == 'pull_request_target' }}
run: |
git fetch origin pull/${{ github.event.pull_request.number }}/head
git checkout FETCH_HEAD
- name: Run
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
PR_BODY: "${{ github.event.pull_request.body }}"
PR_NUMBER: "${{ github.event.pull_request.number }}"
run: |
./script/check-size
+1 -1
View File
@@ -32,7 +32,7 @@ set -euo pipefail
OT_TMP_DIR=/tmp/ot-size-report
readonly OT_TMP_DIR
OT_SHA_NEW=${GITHUB_SHA:-$(git rev-parse HEAD)}
OT_SHA_NEW="$(git rev-parse HEAD)"
readonly OT_SHA_NEW
OT_SHA_OLD="${OT_SHA_OLD:-$(git cat-file -p "${OT_SHA_NEW}" | grep 'parent ' | head -n1 | cut -d' ' -f2)}"
+8
View File
@@ -54,6 +54,14 @@ get_pr_body()
{
local pr
if [[ -z ${PR_BODY+x} ]]; then
echo 'PR_BODY is not set' >&2
else
echo 'PR_BODY is set' >&2
echo "${PR_BODY}"
return 0
fi
[[ ${GITHUB_ACTIONS+x} && ${GITHUB_REF-} =~ ^refs/pull/[0-9]+/merge ]] || {
echo 'Not a pull request.' >&2
return 0