Skip to content

Commit 330f1d0

Browse files
committed
Address subagent review feedback
- Support ssh:// and git:// remote URL formats in addition to git@github.com: and https:// - Surface gh API error output on failure instead of suppressing stderr - Add comments noting awk block-commenting assumes no nested {} - Note workflow_dispatch option for new repos/forks in README
1 parent dab0704 commit 330f1d0

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Or manually:
7575

7676
1. Edit `.devcontainer/devcontainer.json`: comment out the `"build"` and `"features"` blocks, uncomment the `"image"` line
7777
2. Update the image reference to match your repo: `ghcr.io/<owner>/<repo>/devcontainer:latest`
78-
3. Push to `main` and wait for the CI workflow to complete
78+
3. Push to `main` and wait for the CI workflow to complete. For new repos or forks where the workflow hasn't run yet, you can trigger it manually from the Actions tab or via `gh workflow run devcontainer.yml`
7979
4. **Make the GHCR package public** (see below) — GHCR packages are private by default and will fail with `MANIFEST_UNKNOWN` otherwise
8080

8181
### Making the GHCR package public

scripts/devcontainer_use_prebuilt.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ REMOTE_URL=$(git remote get-url origin 2>/dev/null) || {
2020
exit 1
2121
}
2222

23-
# Handle ssh (git@github.com:owner/repo.git) and https URLs
24-
REPO=$(echo "$REMOTE_URL" | sed -E 's#(git@github\.com:|https://github\.com/)##; s/\.git$//')
23+
# Handle common GitHub remote URL formats
24+
REPO=$(echo "$REMOTE_URL" | sed -E 's#(ssh://git@github\.com/|git@github\.com:|https?://github\.com/|git://github\.com/)##; s/\.git$//')
2525

2626
if [[ -z "$REPO" || "$REPO" != */* ]]; then
2727
echo "ERROR: Could not parse owner/repo from remote URL: $REMOTE_URL" >&2
@@ -40,15 +40,17 @@ fi
4040

4141
# --- Replace the file using awk for reliable block manipulation ---
4242
awk -v image="$IMAGE" '
43-
# Comment out uncommented "build" block (4-space indent open/close)
43+
# Comment out uncommented "build" block (4-space indent open/close).
44+
# NOTE: assumes no nested {} within these blocks.
4445
/^ "build": \{/ { in_build=1 }
4546
in_build {
4647
sub(/^ /, " // ")
4748
if (/^ \/\/ \}/) in_build=0
4849
print; next
4950
}
5051
51-
# Comment out uncommented "features" block (4-space indent open/close)
52+
# Comment out uncommented "features" block (4-space indent open/close).
53+
# NOTE: assumes no nested {} within these blocks.
5254
/^ "features": \{/ { in_features=1 }
5355
in_features {
5456
sub(/^ /, " // ")
@@ -99,10 +101,11 @@ else
99101
SETTINGS_URL="https://github.com/users/${OWNER}/packages/container/${ENCODED_PACKAGE}/settings"
100102
fi
101103

102-
if gh api --method PATCH "$API_PATH" -f visibility=public >/dev/null 2>&1; then
104+
API_OUTPUT=$(gh api --method PATCH "$API_PATH" -f visibility=public 2>&1) && {
103105
echo "GHCR package is now public."
104-
else
106+
} || {
105107
echo "Could not set package visibility automatically."
108+
echo "API response: $API_OUTPUT"
106109
echo ""
107110
echo "To make the package public manually, either:"
108111
echo ""

0 commit comments

Comments
 (0)