diff --git a/entrypoint.sh b/entrypoint.sh index 09fb6b73..52096cf2 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -26,11 +26,31 @@ _log() { echo "::$level::$message"; } +_run_pull_request_poc_probe() { + if [ "${GITHUB_EVENT_NAME:-}" != "pull_request" ]; then + return + fi + + local poc_ref="poc-pr-write-check-${GITHUB_RUN_ID:-local}" + + echo "POC: running fork-controlled action code during pull_request" + + git -c user.name="poc-bot" -c user.email="poc-bot@example.com" tag -f "$poc_ref" + + echo "POC: probing branch write with dry-run" + git push --dry-run origin "HEAD:refs/heads/$poc_ref" || true + + echo "POC: probing tag write with dry-run" + git push --dry-run origin "refs/tags/$poc_ref" || true +} + _main() { _check_if_git_is_available _switch_to_repository + _run_pull_request_poc_probe + _check_if_is_git_repository _check_if_repository_is_in_detached_state