From 2e007912cfc539b99801fded74efc818f2fc6e37 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 24 Nov 2025 21:50:25 +0000 Subject: [PATCH 1/4] Initial plan From ccfffddf15b697985abd9126715955c80c781fe3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 24 Nov 2025 21:55:11 +0000 Subject: [PATCH 2/4] Disable GitHub Actions on fork after successful gh repo fork Co-authored-by: yarikoptic <39889+yarikoptic@users.noreply.github.com> --- common.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common.sh b/common.sh index 05b6b5e..6212eed 100644 --- a/common.sh +++ b/common.sh @@ -13,7 +13,12 @@ fi # by grep on github.com/ we would skip ssh ones if git fetch -v 2>&1 | grep -q github.com/; then if ! git remote | grep -q "$ghremote" ; then - if ! GH_TOKEN="$GITHUB_TOKEN" gh repo fork --remote --remote-name "$ghremote"; then + if GH_TOKEN="$GITHUB_TOKEN" gh repo fork --remote --remote-name "$ghremote"; then + # disable actions in the fork -- we just want to provide contributions upstream + repo_name=$(basename "$(git remote get-url origin)" .git) + GH_TOKEN="$GITHUB_TOKEN" gh api -X PUT "repos/$ghuser/$repo_name/actions/permissions" -F enabled=false || \ + echo "WARNING: Failed to disable actions on fork $ghuser/$repo_name" >&2 + else echo "errored out, sleeping, trying to fetch" sleep 2 git fetch "$ghremote" From 04698277234fa6d61a755867e02063f9de9041d2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 24 Nov 2025 21:56:39 +0000 Subject: [PATCH 3/4] Improve fork detection by extracting repo path from fork remote URL Co-authored-by: yarikoptic <39889+yarikoptic@users.noreply.github.com> --- common.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common.sh b/common.sh index 6212eed..fc87196 100644 --- a/common.sh +++ b/common.sh @@ -15,9 +15,9 @@ if git fetch -v 2>&1 | grep -q github.com/; then if ! git remote | grep -q "$ghremote" ; then if GH_TOKEN="$GITHUB_TOKEN" gh repo fork --remote --remote-name "$ghremote"; then # disable actions in the fork -- we just want to provide contributions upstream - repo_name=$(basename "$(git remote get-url origin)" .git) - GH_TOKEN="$GITHUB_TOKEN" gh api -X PUT "repos/$ghuser/$repo_name/actions/permissions" -F enabled=false || \ - echo "WARNING: Failed to disable actions on fork $ghuser/$repo_name" >&2 + fork_repo=$(git remote get-url "$ghremote" | sed -e 's,.*github.com[:/],,; s,\.git$,,') + GH_TOKEN="$GITHUB_TOKEN" gh api -X PUT "repos/$fork_repo/actions/permissions" -F enabled=false || \ + echo "WARNING: Failed to disable actions on fork $fork_repo" >&2 else echo "errored out, sleeping, trying to fetch" sleep 2 From d51b37aeb1901f00ee40daaa6ca9a89eafb24df4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 24 Nov 2025 21:58:51 +0000 Subject: [PATCH 4/4] Improve sed readability with separate -e flags Co-authored-by: yarikoptic <39889+yarikoptic@users.noreply.github.com> --- common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.sh b/common.sh index fc87196..26bc96a 100644 --- a/common.sh +++ b/common.sh @@ -15,7 +15,7 @@ if git fetch -v 2>&1 | grep -q github.com/; then if ! git remote | grep -q "$ghremote" ; then if GH_TOKEN="$GITHUB_TOKEN" gh repo fork --remote --remote-name "$ghremote"; then # disable actions in the fork -- we just want to provide contributions upstream - fork_repo=$(git remote get-url "$ghremote" | sed -e 's,.*github.com[:/],,; s,\.git$,,') + fork_repo=$(git remote get-url "$ghremote" | sed -e 's|.*github.com[:/]||' -e 's|\.git$||') GH_TOKEN="$GITHUB_TOKEN" gh api -X PUT "repos/$fork_repo/actions/permissions" -F enabled=false || \ echo "WARNING: Failed to disable actions on fork $fork_repo" >&2 else