| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
Some checks failed
github-dispatch.yml / fix: use workflow_dispatch instead of repository_dispatch (push) Failing after 0s
repository_dispatch requires Contents:write on the caller's PAT, which is broader than needed. workflow_dispatch only needs Actions:write, matching the tightest useful scope for this flow. |
||
| .forgejo/workflows | ||
| README.md | ||
forgejo-workflows
Shared reusable Forgejo Actions workflows.
github-dispatch.yml
Triggers a workflow_dispatch on a specific workflow in a GitHub repo. Used to kick off a sync-and-publish workflow on a GitHub mirror after a release is cut on Forgejo.
Uses the workflow_dispatch endpoint (not repository_dispatch) because the latter requires Contents: write on the PAT for no good reason — workflow_dispatch only needs Actions: write, which is the tightest scope that still gets the job done.
Caller example
Drop this into each library repo at .forgejo/workflows/trigger-github.yml:
on:
release:
types: [published]
jobs:
dispatch:
uses: james/forgejo-workflows/.forgejo/workflows/github-dispatch.yml@main
secrets: inherit
Defaults assume the GitHub mirror is hughesjs/<same-repo-name> and the target workflow is sync-and-publish.yml on main. Override via with.github_owner, with.github_repo, with.workflow, with.ref if needed.
Required secret
GITHUB_DISPATCH_PAT — a GitHub fine-grained PAT with Actions: write + Metadata: read on the target repo(s). Set it once as a user-level secret at /user/settings/actions/secrets and all callers pick it up via secrets: inherit.
Forwarded context
The caller's Forgejo repo/ref/SHA are passed through as workflow inputs (forgejo_repo, forgejo_ref, forgejo_sha). The GitHub-side sync-and-publish.yml should declare them on its workflow_dispatch inputs if it wants to use them for logging/idempotency.