aRustyDev / aRustyDev/gh

feat: Add `trigger-remote-workflow` action

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
enhancement new-action
Dominant language
Shell
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.