diff --git a/action.yml b/action.yml index 46431b7..d76990f 100644 --- a/action.yml +++ b/action.yml @@ -73,6 +73,14 @@ runs: run: | . "$GITHUB_ACTION_PATH/utils.sh" + # If we were triggered by a PR then this is easy + if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then + log "Triggered by a pull request with index: $GITHUB_HEAD_REF" + log "Expected PR URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/pulls/$GITHUB_HEAD_REF" + echo "pr-number=$GITHUB_HEAD_REF" >> "$GIHUB_OUTPUT" + exit 0 + fi + log 'Determine head_ref' # For push & tag events it'll bet GITHUB_REF_NAME, for pull_request events it'll be GITHUB_HEAD_REF head_ref=${GITHUB_REF_NAME:-$GITHUB_HEAD_REF}