Skip to content

Commit

Permalink
Merge pull request #16 from antmicro/mczyz/add-pull-request-target
Browse files Browse the repository at this point in the history
Add pull_request_target target to pull_request logic
  • Loading branch information
tgorochowik authored May 31, 2023
2 parents 75fe097 + f5cf09d commit e75c887
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ runs:
echo "ARTIFACT_PATH : $artifact_path"
echo "# --- "
if [ "${{ github.event_name }}" == "pull_request" ]; then
if [ "${{ github.event_name }}" == "pull_request" ] || [ "${{ github.event_name }}" == "pull_request_target" ]; then
echo "### Prepare PR branch ###"
echo "-------------------------"
event_file=event.json
diff_cmd="git diff FETCH_HEAD"
if [ -f "$event_file" ]; then
pr_branch=$(python3 -c "import sys, json; print(json.load(sys.stdin)['pull_request']['head']['ref'])" < $event_file)
base_branch=$(python3 -c "import sys, json; print(json.load(sys.stdin)['pull_request']['base']['ref'])" < $event_file)
pr_branch=$(python3 -c "import sys, json; print(json.load(sys.stdin)['${{ github.event_name }}']['head']['ref'])" < $event_file)
base_branch=$(python3 -c "import sys, json; print(json.load(sys.stdin)['${{ github.event_name }}']['base']['ref'])" < $event_file)
git fetch origin $pr_branch
git checkout $pr_branch
echo "PR branch : $pr_branch"
Expand All @@ -86,7 +86,7 @@ runs:
git stash
echo "# --- "
if [ "${{ github.event_name }}" == "pull_request" ]; then
if [ "${{ github.event_name }}" == "pull_request" ] || [ "${{ github.event_name }}" == "pull_request_target" ]; then
echo "### Run reviewdog ###"
echo "---------------------"
export REVIEWDOG_GITHUB_API_TOKEN="${{ inputs.github_token }}"
Expand Down

0 comments on commit e75c887

Please sign in to comment.