-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·24 lines (18 loc) · 808 Bytes
/
entrypoint.sh
File metadata and controls
executable file
·24 lines (18 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
set -eu
script_dir="$(dirname "$0")"
cd $script_dir
pull_request_id=$(cat "$GITHUB_EVENT_PATH" | jq 'if (.issue.number != null) then .issue.number else .number end')
branch_name="pull_request_branch"
if [ $pull_request_id == "null" ]; then
echo "Could not find a pull request ID. Is this a pull request?"
exit 1
fi
maintainer=${GITHUB_REPOSITORY%/*}
eval git clone "https://${maintainer}:${INPUT_GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" ${GITHUB_REPOSITORY}
cd $GITHUB_REPOSITORY
eval git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
eval git fetch origin pull/$pull_request_id/head:$branch_name
eval git checkout $branch_name
latest_head=$(git rev-parse HEAD)
eval python3 /action/run_action.py --latest-head $latest_head --pull-request-id $pull_request_id