feat: Add `trigger-remote-workflow` action
- Lingua principale
- Shell
- Stelle
- 0
- Fork
- 0
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
## Summary
Create a reusable GitHub Action that dispatches a `repository_dispatch` event to a target repository with auto-populated context from the source workflow.
## Use Case
Enable source repositories (e.g., `arustydev/ai`, `arustydev/just`) to trigger workflows in a target repository (e.g., `arustydev/docs`) when their documentation changes. The action automatically populates payload context from GitHub environment variables.
## Specification
### Inputs
| Input | Required | Default | Description |
|-------|----------|---------|-------------|
| `target_repo` | Yes | — | Repository to trigger (owner/repo) |
| `event_type` | Yes | — | Event type for repository_dispatch |
| `token` | Yes | — | PAT with `repo` scope for target |
| `source_repo` | No | `${{ github.repository }}` | Source repository |
| `ref` | No | `${{ github.ref_name }}` | Branch/tag that triggered |
| `sha` | No | `${{ github.sha }}` | Commit SHA |
| `path` | No | — | Relevant path (for filtering) |
### Auto-populated Payload
```json
{
"source_repo": "arustydev/ai",
"ref": "main",
"sha": "abc1234...",
"path": "docs/src"
}
```
### Example Usage
```yaml
- uses: arustydev/gha/trigger-remote-workflow@v1
with:
target_repo: arustydev/docs
event_type: docs-update
token: ${{ secrets.DISPATCH_TOKEN }}
path: docs/src
```
## Implementation Notes
- Use GitHub API to send `repository_dispatch` event
- Auto-detect context from `github.*` environment variables when inputs not provided
- Validate target_repo format (owner/repo)
- Handle API errors gracefully with clear error messages
## Related
- Part of docs aggregation workflow extraction from justfile to GHA
- Works with `sparse-checkout-aggregate` action in target repo
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con le sezioni Inputs, Auto-populated Payload ed Example Usage, quindi esamina i requisiti della GitHub API per l’invio di un evento repository_dispatch. Implementa l’action riutilizzabile in base agli inputs specificati, ai valori predefiniti del contesto, alla convalida del repository e alla gestione degli errori; il lavoro è completato quando può attivare il workflow di destinazione documentato con il payload previsto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- github-actions, shell
- Ambito
- ci-cd, devops
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100