Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 1 addition & 72 deletions docs/github-integration.md
Original file line number Diff line number Diff line change
@@ -1,77 +1,6 @@
# GitHub Integration

STRUCT can seamlessly integrate with GitHub to automate the generation of project structures across repositories. This documentation explains how to set up and use the GitHub trigger script.

## GitHub Trigger Script

The `github-trigger.py` script is a utility designed to trigger the `run-struct` workflow for all private repositories in a GitHub organization that meet specific criteria. This script is particularly useful for automating tasks across multiple repositories.

### Features

- Filters repositories by a specific topic (e.g., `struct-enabled`).
- Checks for the existence of a `.struct.yaml` file in the repository's default branch.
- Verifies the presence of the `run-struct` workflow file in `.github/workflows/`.
- Triggers the workflow dispatch event for eligible repositories.

### Usage

To use the script, ensure you have the following prerequisites:

1. A valid GitHub Personal Access Token with the necessary permissions (set as the `GITHUB_TOKEN` environment variable).
2. The `PyGithub` library installed (`pip install PyGithub`).

Run the script with the following command:

```sh
python3 scripts/github-trigger.py <organization> <topic>
```

#### Arguments

- `<organization>`: The name of the GitHub organization.
- `<topic>`: The topic to filter repositories by (e.g., `struct-enabled`).

#### Example

```sh
export GITHUB_TOKEN=your_personal_access_token
python3 scripts/github-trigger.py my-org struct-enabled
```

### How It Works

1. The script connects to the GitHub API using the provided token.
2. It iterates through all private repositories in the specified organization.
3. For each repository:
- Checks if the repository has the specified topic.
- Verifies the existence of a `.struct.yaml` file in the default branch.
- Confirms the presence of the `run-struct` workflow file.
- Triggers the workflow dispatch event if all conditions are met.

### Notes

- Ensure the `GITHUB_TOKEN` environment variable is set before running the script.
- The token must have sufficient permissions to access private repositories and trigger workflows.
- Errors during execution (e.g., missing files or insufficient permissions) will be logged to the console.

### Advanced Usage

Add additional parameters to customize the script's behavior:

- `--dry-run`: Simulate the script actions without executing any API calls.
- `--verbose`: Enable verbose output for debugging purposes.

Example:

```sh
python3 scripts/github-trigger.py my-org struct-enabled --dry-run --verbose
```

### Troubleshooting

- **Unauthorized Error**: Make sure your token has the appropriate permissions.
- **Repository Not Found**: Ensure the organization name is correct and the token has access.
- **Missing Files**: Verify that the `.struct.yaml` and workflow files exist in each repository.
STRUCT can seamlessly integrate with GitHub to automate the generation of project structures across repositories.

## Automating STRUCT

Expand Down
57 changes: 0 additions & 57 deletions scripts/github-trigger.py

This file was deleted.

18 changes: 18 additions & 0 deletions struct_module/contribs/prompts/run-struct-trigger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
files:
- run-struct-trigger.md:
content: |
You are a helpful assistant that can query Github Using MCP

I will need you to get the list of repositories that have the following topic: "{{@ topic @}}"
The organization should be "{{@ github_organization @}}"

To all those repositories, you will need to trigger a workflow called "run-struct"

variables:
- github_organization:
type: string
description: The organization to query for repositories
- topic:
type: string
description: The topic to query for repositories
default: "struct-enabled"
Loading