fix: disinto init: auto-generate WOODPECKER_TOKEN for repo activation (#779) (#790)

Fixes #779

## Changes
Auto-generate WOODPECKER_TOKEN during disinto init by automating the Forgejo OAuth2 login flow after the compose stack starts. Adds generate_woodpecker_token() function that: logs into Forgejo web UI, drives the OAuth2 authorize/consent flow, completes the Woodpecker callback to get a session token, then creates a persistent personal access token via Woodpecker API. Saves to .env so activate_woodpecker_repo() can use it immediately. Failures are non-fatal (guarded with || true).

Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/disinto/pulls/790
Reviewed-by: Disinto_bot <disinto_bot@noreply.codeberg.org>
This commit is contained in:
johba 2026-03-27 14:01:28 +01:00
parent 2401e6b74a
commit ef544f58f9
2 changed files with 192 additions and 3 deletions

View file

@ -21,9 +21,9 @@ FAILED=0
# Uses awk instead of grep -Eo for busybox/Alpine compatibility (#296).
get_fns() {
local f="$1"
# Use grep+sed instead of awk for BusyBox compatibility — BusyBox awk
# unreliably handles [(][)] bracket expressions in some Alpine builds.
grep -E '^[[:space:]]*[a-zA-Z_][a-zA-Z0-9_]+[[:space:]]*\(\)' "$f" 2>/dev/null \
# BRE mode (no -E): () is literal in BRE, avoiding BusyBox ERE bugs
# where \(\) is misinterpreted. BRE one-or-more via [X][X]* instead of +.
grep '^[[:space:]]*[a-zA-Z_][a-zA-Z0-9_][a-zA-Z0-9_]*[[:space:]]*()' "$f" 2>/dev/null \
| sed 's/^[[:space:]]*//; s/[[:space:]]*().*$//' \
| sort -u || true
}