From 58641e5f3bffaa89b08239531e4cbe82757f872e Mon Sep 17 00:00:00 2001 From: Jesse Houwing Date: Fri, 24 Mar 2023 09:44:09 +0000 Subject: [PATCH 1/9] Fixes codespaces --- .devcontainer/Dockerfile | 4 ++-- .devcontainer/devcontainer.json | 2 +- script/create-files | 20 -------------------- script/create-practice-repos | 4 ++-- 4 files changed, 5 insertions(+), 25 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ae9fb7b1..9b390707 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,7 +1,7 @@ # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.222.0/containers/ubuntu/.devcontainer/base.Dockerfile # [Choice] Ubuntu version (use hirsuite or bionic on local arm64/Apple Silicon): hirsute, focal, bionic -ARG VARIANT="hirsute" +ARG VARIANT="jammy" FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT} # [Optional] Uncomment this section to install additional OS packages. @@ -10,5 +10,5 @@ FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT} RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ && apt-get -y install --no-install-recommends \ - gettext-base=0.21-3ubuntu2 \ + gettext-base=0.21-4ubuntu4cd \ && rm -rf /var/lib/apt/lists/* diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 79c92e67..f154f2c8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,7 +6,7 @@ "dockerfile": "Dockerfile", // Update 'VARIANT' to pick an Ubuntu version: hirsute, focal, bionic // Use hirsute or bionic on local arm64/Apple Silicon. - "args": { "VARIANT": "hirsute" } + "args": { "VARIANT": "jammy" } }, // Set *default* container specific settings.json values on container create. diff --git a/script/create-files b/script/create-files index 906e8f96..7961e38f 100755 --- a/script/create-files +++ b/script/create-files @@ -131,24 +131,6 @@ create_issues() { fi } -make_repo_private() { - # Check if the repo is private - repo_is_private=$(curl -s -S -u "$TOKEN_OWNER:$TEACHER_PAT" -X GET "$repo_endpoint" | jq .private) >>log.out 2>&1 - - # If the repo is private - if "$repo_is_private"; then - echo "This repo is already private." - return # exit the function - fi - - # Default to 'yes' if no answer is given - if ask "Are you ready to make this repo private?" Y; then - # Make the repo private - curl -s -S -i -u "$TOKEN_OWNER:$TEACHER_PAT" -d "{ \"name\": \"$collab_repo\", \"private\": true }" -X PATCH "$repo_endpoint" >>log.out 2>&1 - else - echo "OK, just remember to make the repo private and add the info for booking 1:1 appointments to the README." - fi -} get_commenters() { # Array of commenters @@ -211,5 +193,3 @@ create_files # Create issues create_issues -# Make it private -make_repo_private diff --git a/script/create-practice-repos b/script/create-practice-repos index 0b9960e4..0b098eec 100755 --- a/script/create-practice-repos +++ b/script/create-practice-repos @@ -106,7 +106,7 @@ create_practice_repo() { create_repo \ --name "$repo_name" \ --description "$repo_description" \ - --private true \ + --private false \ --has_wiki false git_push "$repo_name" @@ -132,7 +132,7 @@ create_practice_repo() { --name "$repo_name" \ --description "$repo_description" \ --homepage "$template_pages_url" \ - --private true \ + --private false \ --has_wiki false git_push "$repo_name" From 5cf533a354b4e611b5bda1e13fcad0d480b692ea Mon Sep 17 00:00:00 2001 From: Jesse Houwing Date: Wed, 12 Apr 2023 12:23:59 +0000 Subject: [PATCH 2/9] Fixing the devcontainer AGAIN --- .devcontainer/Dockerfile | 2 +- script/create-initial-repo | 19 ++----------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 9b390707..51d6ec95 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -10,5 +10,5 @@ FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT} RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ && apt-get -y install --no-install-recommends \ - gettext-base=0.21-4ubuntu4cd \ + gettext-base=0.21-4ubuntu4 \ && rm -rf /var/lib/apt/lists/* diff --git a/script/create-initial-repo b/script/create-initial-repo index d501d7c6..82e62482 100755 --- a/script/create-initial-repo +++ b/script/create-initial-repo @@ -129,22 +129,7 @@ update_readme() { --message "Update _config.yml" } -create_initial_project() { - # Create project and save the project ID so we can use it to create project columns and cards - create_repo_project --repo "$initial_repo_name" \ - --name "Caption Contest" \ - --body "Let's see who can create the best captions for our collection of memes." - local project_id="$REPO_PROJECT_ID" - - # Create project columns and save the ID of the first colum so we can add a card to it - create_project_column --project_id "$project_id" --name "To do" && local column_one="$COLUMN_ID" - create_project_column --project_id "$project_id" --name "In progress" - create_project_column --project_id "$project_id" --name "Done" - - # Add a note to column one - create_project_card --project_id "$project_id" --column_id "$column_one" \ - --note "Each student will update their file in the _slides directory with an image and a caption." -} + update_branch_protections() { # Update branch protection rules for the default branch @@ -205,7 +190,7 @@ clone_initial_repo update_readme update_branch_protections create_initial_issue -create_initial_project +#create_initial_project enable_github_pages print_done "Here's a link to the repo: $repo_url" From eb5830035d20854afda4b56b76c354f6193de25f Mon Sep 17 00:00:00 2001 From: Jesse Houwing Date: Thu, 13 Apr 2023 10:09:09 +0000 Subject: [PATCH 3/9] Wait a lottle longer to prevent rate limiting --- script/create-practice-repos | 1 + script/shared_functions | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/script/create-practice-repos b/script/create-practice-repos index 0b098eec..0535b120 100755 --- a/script/create-practice-repos +++ b/script/create-practice-repos @@ -83,6 +83,7 @@ generate_repos() { else # create a new practice repository create_practice_repo "$username" + sleep 5 fi done } diff --git a/script/shared_functions b/script/shared_functions index c7731b22..71b97e79 100755 --- a/script/shared_functions +++ b/script/shared_functions @@ -270,7 +270,7 @@ create_issue() { echo -n "Creating issue: $title... " # Wait for 2 second to avoid secondary rate limiting, 1 second was nog enough - sleep 2 + sleep 5 if http --check-status --ignore-stdin --quiet --auth \ "$TOKEN_OWNER:$TEACHER_PAT" "$org_repos_endpoint/$repo/issues" \ From 2d19eea37c325e537092d88512adccbfb9eee641 Mon Sep 17 00:00:00 2001 From: Jesse Houwing Date: Wed, 17 May 2023 11:11:14 +0000 Subject: [PATCH 4/9] Fixes codespace --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f154f2c8..f6b25861 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -21,7 +21,7 @@ // Use 'postCreateCommand' to run commands after the container is created. // "postCreateCommand": "uname -a", - "postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh", + "postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh && pip install 'urllib3<2'", // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode", From 54edc61a2e64d1fe43e5fb39941683841aa980f5 Mon Sep 17 00:00:00 2001 From: Jesse Houwing Date: Wed, 17 May 2023 11:21:53 +0000 Subject: [PATCH 5/9] Cleaner version of the codespace fix --- .devcontainer/devcontainer.json | 2 +- .devcontainer/postCreateCommand.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f6b25861..f154f2c8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -21,7 +21,7 @@ // Use 'postCreateCommand' to run commands after the container is created. // "postCreateCommand": "uname -a", - "postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh && pip install 'urllib3<2'", + "postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh", // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode", diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh index a163bb8c..91825e13 100755 --- a/.devcontainer/postCreateCommand.sh +++ b/.devcontainer/postCreateCommand.sh @@ -3,3 +3,4 @@ npm install -g docsify-cli python -m pip install --upgrade pip setuptools python -m pip install --upgrade httpie +python -m pip install 'urllib3<2' \ No newline at end of file From 6c20aa2d97a4eaca1fbdfd9a143795a777587a44 Mon Sep 17 00:00:00 2001 From: Jesse Houwing Date: Wed, 6 Sep 2023 23:04:58 +0200 Subject: [PATCH 6/9] Update devcontainer.json --- .devcontainer/devcontainer.json | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f154f2c8..8bd4ace7 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -11,7 +11,19 @@ // Set *default* container specific settings.json values on container create. "settings": {}, - + "customizations": { + // Configure properties specific to Codespaces. + "codespaces": { + "repositories": { + "github/gh-valet": { + "permissions": { + "contents": "read", + "packages": "read" + } + } + } + } + }, // Add the IDs of extensions you want installed when the container is created. "extensions": [], From c7fed84bf5e8ffe161afa404c861f045f736a7f3 Mon Sep 17 00:00:00 2001 From: Jesse Houwing Date: Wed, 6 Sep 2023 23:06:58 +0200 Subject: [PATCH 7/9] Update postCreateCommand.sh --- .devcontainer/postCreateCommand.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh index 91825e13..2619aed7 100755 --- a/.devcontainer/postCreateCommand.sh +++ b/.devcontainer/postCreateCommand.sh @@ -3,4 +3,6 @@ npm install -g docsify-cli python -m pip install --upgrade pip setuptools python -m pip install --upgrade httpie -python -m pip install 'urllib3<2' \ No newline at end of file +python -m pip install 'urllib3<2' + +gh extension install github/gh-valet From a480e8ea5a077a8a524317e41ca39f3a239b2be3 Mon Sep 17 00:00:00 2001 From: Jesse Houwing Date: Thu, 7 Sep 2023 00:02:04 +0200 Subject: [PATCH 8/9] Update devcontainer.json --- .devcontainer/devcontainer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8bd4ace7..7e97a3ea 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -15,8 +15,9 @@ // Configure properties specific to Codespaces. "codespaces": { "repositories": { - "github/gh-valet": { + "github/gh-actions-importer": { "permissions": { + "metadata": "read", "contents": "read", "packages": "read" } From 4d1916e2064ccc70c672b1032dd2a2a490a94d40 Mon Sep 17 00:00:00 2001 From: Jesse Houwing Date: Thu, 7 Sep 2023 00:02:40 +0200 Subject: [PATCH 9/9] Update postCreateCommand.sh --- .devcontainer/postCreateCommand.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh index 2619aed7..7b314c0a 100755 --- a/.devcontainer/postCreateCommand.sh +++ b/.devcontainer/postCreateCommand.sh @@ -5,4 +5,13 @@ python -m pip install --upgrade pip setuptools python -m pip install --upgrade httpie python -m pip install 'urllib3<2' -gh extension install github/gh-valet + +type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y) +curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ +&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \ +&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ +&& sudo apt update \ +&& sudo apt install gh -y + +gh extension install github/gh-actions-importer +gh actions-importer update