Pular para o conteúdo principal

Grupos/Organizações

ELT73A-S22-2026-2 Teams​

for letter in A B C D E F G H I J K L M X; do
gh api --method POST --silent orgs/ELT73A-S22-2026-2/teams \
-f name="Grupo-$letter" \
-f privacy="closed"
done
Organization: ELT73A-S22-2026-2
│
├── Teams
│ ├── Grupo-A
│ ├── Grupo-B
│ ├── Grupo-C
│ └── ...
│
└── Repositories
├── lab00-template
├── lab00-grupo-a
├── lab00-grupo-b
├── ...
├── lab10-template
├── lab10-grupo-a
├── lab10-grupo-b
├── ...
├── projeto-template
├── projeto-grupo-a
├── projeto-grupo-b
└── ...

List your teams and their slugs:

gh api orgs/ELT73A-S22-2026-2/teams --jq '.[] | "\(.name) → \(.slug)"'

List members

gh api orgs/ELT73A-S22-2026-2/teams/grupo-a/members --jq '.[].login'

List repos for a team

gh api orgs/ELT73A-S22-2026-2/teams/grupo-a/repos --jq '.[].full_name'

Here’s a script that creates the lab templates (lab00-template, lab01-template, …):

#!/bin/bash

ORG="ELT73A-S22-2026-2"
NLABS=10 # Creates lab00-template → lab10-template

echo "Creating lab templates in organization: $ORG"
echo ""

for lab in $(seq -w 0 $NLABS); do
REPO="lab${lab}-template"

echo "Creating $REPO..."

# Create the repository
gh repo create "$ORG/$REPO" \
--private \
--description "Template for LAB$lab" \
--add-readme \
--silent

# Mark it as a template repository
gh api --method PATCH --silent \
"repos/$ORG/$REPO" \
-f is_template=true

echo " ✓ $REPO created and marked as template"
done

echo ""
echo "All lab templates created successfully!"
echo ""
echo "You can now use them like this:"
echo " TEMPLATE=\"$ORG/lab05-template\""

Create only one specific template

ORG="ELT73A-S22-2026-2"
NLAB=0
LAB=$(printf "%02d" $NLAB)
REPO="lab${LAB}-template"

gh repo create "$ORG/$REPO" \
--private \
--description "Template for LAB$LAB" \
--add-readme

gh api --method PATCH \
"repos/$ORG/$REPO" \
-f is_template=true
./scripts/create-lab-repos.sh
#!/bin/bash
set -e

ORG="ELT73A-S22-2026-2"
GROUP_LIST="A B C D E F G H I J K L M X" # ← not GROUPS
NLAB=0
LAB=$(printf "lab%02d" "$NLAB")
TEMPLATE="$ORG/${LAB}-template"

echo "GROUP_LIST=[$GROUP_LIST]"
echo "Creating ${LAB}-grupo-* from $TEMPLATE"
echo ""

for letter in $GROUP_LIST; do
GROUP_LOWER=$(echo "$letter" | tr '[:upper:]' '[:lower:]')
TEAM_SLUG="grupo-${GROUP_LOWER}"
REPO="${LAB}-grupo-${GROUP_LOWER}"

echo "→ $REPO (team: $TEAM_SLUG)"

if gh repo view "$ORG/$REPO" &>/dev/null; then
echo " ⚠ already exists, skipping create"
else
gh repo create "$ORG/$REPO" \
--private \
--template "$TEMPLATE" \
--description "LAB$(printf '%02d' "$NLAB") - Grupo $letter"
fi

if gh api --method PUT --silent \
"orgs/$ORG/teams/$TEAM_SLUG/repos/$ORG/$REPO" \
-f permission=push; then
echo " ✓ https://github.com/$ORG/$REPO"
else
echo " ✗ Failed to add team $TEAM_SLUG"
fi
done

echo ""
echo "Done."

Cheatsheet for your org​

ORG="ELT73A-S22-2026-2"

# List teams
gh api "orgs/$ORG/teams" --jq '.[] | "\(.name) → \(.slug)"'

# Create all groups
for L in A B C D E F G H I J K L M X; do
gh api --method POST "orgs/$ORG/teams" \
-f name="Grupo-$L" -f privacy="closed" --silent
done

# Give team write on a lab repo
gh api --method PUT \
"orgs/$ORG/teams/grupo-a/repos/$ORG/lab00-grupo-a" \
-f permission="push"

# Add a student to a team
gh api --method PUT \
"orgs/$ORG/teams/grupo-a/memberships/student-username" \
-f role="member"