-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathutils.just
More file actions
30 lines (24 loc) · 1018 Bytes
/
utils.just
File metadata and controls
30 lines (24 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
set quiet
gh := `which gh`
[private]
default:
just -f {{justfile_directory()}}/utils.just --list
# Show unarchived repos owned by the specified team on GitHub
[group("info")]
list-repos team: # We currently have 'observability', 'observability-core', 'tracing-and-profiling', 'service-mesh'
gh api "orgs/canonical/teams/{{team}}/repos" --paginate | jq -r '.[] | select(.archived == false and .disabled == false) | .full_name' | sort
# Set a secret for all the unarchived the repositories of a GitHub team
[group("secrets")]
set-team-secret team secret:
#!/usr/bin/env bash
# Make sure the secret is set in an environment variable
if [[ -z "${{secret}}" ]]; then
echo "You must set the {{secret}} environment variable with the secret contents."
exit 1
fi
# Gather the unarchived team repos
repos="$(just -f {{justfile_directory()}}/utils.just list-repos {{team}})"
# Set the secrets
for repo in $repos; do
gh secret set "{{secret}}" --repo "$repo" --body "${{secret}}"
done