diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ae9fb7b1..51d6ec95 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-4ubuntu4 \ && rm -rf /var/lib/apt/lists/* diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 79c92e67..7e97a3ea 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,12 +6,25 @@ "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. "settings": {}, - + "customizations": { + // Configure properties specific to Codespaces. + "codespaces": { + "repositories": { + "github/gh-actions-importer": { + "permissions": { + "metadata": "read", + "contents": "read", + "packages": "read" + } + } + } + } + }, // Add the IDs of extensions you want installed when the container is created. "extensions": [], diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh index a163bb8c..7b314c0a 100755 --- a/.devcontainer/postCreateCommand.sh +++ b/.devcontainer/postCreateCommand.sh @@ -3,3 +3,15 @@ npm install -g docsify-cli python -m pip install --upgrade pip setuptools python -m pip install --upgrade httpie +python -m pip install 'urllib3<2' + + +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 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-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" diff --git a/script/create-practice-repos b/script/create-practice-repos index 0b9960e4..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 } @@ -106,7 +107,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 +133,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" 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" \