Compare commits

...
Author SHA1 Message Date
zramsay 68f0111c2b script to mirror an org/user on gitea 2023-05-26 20:08:40 -04:00
dboreham 45087d9de2 Merge pull request #41 from cerc-io/dboreham/update-config
Update config to remove warning in runner log
2023-05-25 16:31:10 +08:00
dboreham b622724eb7 Update config to remove warning in runner log 2023-05-25 02:30:03 -06:00
dboreham b5a31b2c6b Add note on debugging 2023-05-24 12:12:20 -06:00
dboreham 3f11082d3e Merge pull request #39 from cerc-io/dboreham/fix-token-scope
Add explicit package scope to token
2023-05-23 04:25:09 +08:00
3 changed files with 62 additions and 2 deletions
+8
View File
@@ -16,3 +16,11 @@ docker build -t cerc/act-runner:local .
1. Bring up the gitea cluster `docker compose up -d`
1. Run the script `./initialize-gitea.sh`
1. Note the access token printed, it will be needed to publish packages.
#### Debugging
Gitea server logs can be seen via docker logs <container-id>.
To enable more verbose log output add an environment variable definition like:
```
GITEA__log__LEVEL=TRACE
```
to the `server` definition in `docker-compose.yml` and re-start.
-2
View File
@@ -42,8 +42,6 @@ cache:
port: 0
container:
# Which network to use for the job containers. Could be bridge, host, none, or the name of a custom network.
network_mode: bridge
# Whether to use privileged mode or not when launching task containers (privileged mode is required for Docker-in-Docker).
privileged: true
# And other options to be used when the container is started (eg, --add-host=my.gitea.url:host-gateway).
+54
View File
@@ -0,0 +1,54 @@
#!/bin/bash
ORG=$1
#USERNAME=$1
USER_API_URL="https://api.github.com/users/$USERNAME/repos"
API_URL="https://api.github.com/orgs/$ORG/repos"
PAGE=1
# appears uncoupled from limit of 100 repos
PER_PAGE=100
# Function to retrieve repositories for a given page
get_repos() {
local page=$1
curl -s "$USER_API_URL?page=$page&per_page=$PER_PAGE"
}
# Query GitHub API for the first page of repositories
response=$(get_repos $PAGE)
# Check if organization exists
if [[ $response =~ "Not Found" ]]; then
echo "Organization not found."
exit 1
fi
# Get total number of repositories
total_repos=$(echo "$response" | grep -oE '"full_name": "[^"]+"' | wc -l)
# Initialize array for repositories
repos=()
# Parse repository names and add to the array
repos+=($(echo "$response" | grep -oE '"full_name": "[^"]+"' | awk -F': "' '{print $2}' | tr -d '"'))
# Calculate number of pages needed
num_pages=$((($total_repos + $PER_PAGE - 1) / $PER_PAGE))
# Loop through the remaining pages and retrieve repositories
for ((page=2; page<=num_pages; page++)); do
response=$(get_repos $page)
repos+=($(echo "$response" | grep -oE '"full_name": "[^"]+"' | awk -F': "' '{print $2}' | tr -d '"'))
done
# Loop through the array and output each repository
for repo in "${repos[@]}"; do
echo "$repo"
bash migrate-repo.sh $repo
done
# Display count of repositories
echo "Total Repositories: $total_repos"