- Python 78.9%
- Shell 16.4%
- Dockerfile 4.7%
| .forgejo/workflows | ||
| app | ||
| argocd | ||
| k8s | ||
| scripts | ||
| .dockerignore | ||
| .gitattributes | ||
| .gitignore | ||
| Dockerfile | ||
| README.md | ||
Forgejo → GitHub private activity sync
This service receives Forgejo push webhooks and writes metadata-only commits (--allow-empty) to a private GitHub repository.
1) Repo contents
app/webhook.py— webhook receiverDockerfile— container imagek8s/app.yaml— ConfigMap, Deployment, Service, Ingressk8s/certificate.yaml— cert-manager Certificate for TLSscripts/trigger-webhook-test.sh— local webhook test helper
2) Non-secret values (edit manifests once)
Set these directly in manifests, not in secrets.env:
- k8s/app.yaml
metadata.namespacedata.ACTIVITY_REPOdata.BRANCHdata.AUTHOR_NAMEspec.template.spec.containers[0].image- ingress host rules (
forgejo-activity.i.psilva.org/ your host)
- k8s/certificate.yaml
metadata.namespacespec.commonNamespec.dnsNames
- Forgejo server/ingress/service config is managed in bootstrap Terraform:
bootstrap/terraform/terraform.tfvars(forgejo_values)
3) Secret values
k8s/secrets.env should only have real secrets:
WEBHOOK_SECRET=a-random-long-secret
AUTHOR_EMAIL=you@example.com
GIT_DEPLOY_KEY_PATH=$HOME/.ssh/id_ed25519
To avoid committing plaintext secrets, this repo uses git-crypt to encrypt k8s/secrets.env.
Enable git-crypt (one-time)
# init repo crypt config
git-crypt init
# add your GPG key as trusted collaborator
git-crypt add-gpg-user "you@example.com"
git-crypt will:
- create
.gitattributes(already includesk8s/secrets.env) - create/update
.git-crypt/keys
On a fresh clone (or after CI key rotation)
git-crypt unlock
When your key is configured, k8s/secrets.env will be transparently decrypted after unlock.
4) Deploy (GitOps / CI-only)
Keep the whole flow in Git and CI:
- Set secret in CI:
K8S_KUBECONFIG_B64(base64 kubeconfig)
- Commit
argocd/application.yamlandk8s/*updates. - Trigger:
.forgejo/workflows/argo-bootstrap-application.yamlby workflow_dispatch, or- Any change under
argocd/application.yamlto (re)bootstrap the ArgoCDApplicationobject.
After bootstrap, ArgoCD auto-sync keeps runtime resources reconciled from k8s/.
4b) Deploy with Argo CD (recommended)
Keep argocd/application.yaml as the source of truth and let ArgoCD sync automatically.
CI now has two workflows:
- build-and-push-image builds and pushes image tags.
- build-and-push-image now also runs a second job to update
k8s/app.yamlwith the new image tag after a successful push build onmaster, so ArgoCD auto-sync can roll out the update. - argo-bootstrap-application bootstraps or refreshes the ArgoCD Application object from Git.
Argo CD auto-syncs k8s/ on the repo, so this commit will trigger rollout without manual kubectl apply.
5) Redeploy
Redeploy through standard git flow (no manual kubectl needed):
- Update
k8s/app.yaml(or other files underk8s/) in git. - Push to
master. - ArgoCD app auto-sync applies changes.
6) Wire Forgejo webhook
In Forgejo repo settings:
- URL:
https://YOUR_HOST/forgejo(same host you set ink8s/app.yamlingress) - Method:
POST - Content type:
application/json - Secret: value of
WEBHOOK_SECRET - Events:
Push
7) Send test event
./scripts/trigger-webhook-test.sh
Optional overrides:
HOST(defaultforgejo-activity.i.psilva.org)NAMESPACE(defaultforgejo)INGRESS_NAME(defaultforgejo-activity-sync)PAYLOAD(default test body)
Notes
- Only metadata-only commits are created.
- Keep one-way sync from Forgejo to GitHub to avoid branch conflicts.
- Enable Include private contributions in your GitHub profile if you want the activity to show.