-
Notifications
You must be signed in to change notification settings - Fork 0
chore(workflows): Deploy autonomous workflow system #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,324 @@ | ||||||||||
| # .github/workflows/autonomous-cross-repo.yml | ||||||||||
| # Cross-repository coordination for synchronized changes | ||||||||||
|
|
||||||||||
| name: "Autonomous Cross-Repo Coordinator" | ||||||||||
|
|
||||||||||
| on: | ||||||||||
| push: | ||||||||||
| branches: [main, master] | ||||||||||
| paths: | ||||||||||
| - 'shared/**' | ||||||||||
| - 'packages/**' | ||||||||||
| - 'lib/**' | ||||||||||
| - '*.config.*' | ||||||||||
| workflow_dispatch: | ||||||||||
| inputs: | ||||||||||
| sync_type: | ||||||||||
| description: 'Type of sync' | ||||||||||
| required: true | ||||||||||
| type: choice | ||||||||||
| options: | ||||||||||
| - config | ||||||||||
| - dependencies | ||||||||||
| - workflows | ||||||||||
| - all | ||||||||||
| target_repos: | ||||||||||
| description: 'Target repos (comma-separated, or "all")' | ||||||||||
| required: false | ||||||||||
| default: 'all' | ||||||||||
| dry_run: | ||||||||||
| description: 'Dry run (no actual changes)' | ||||||||||
| required: false | ||||||||||
| default: true | ||||||||||
| type: boolean | ||||||||||
|
|
||||||||||
| permissions: | ||||||||||
| contents: write | ||||||||||
| pull-requests: write | ||||||||||
|
|
||||||||||
| env: | ||||||||||
| BLACKROAD_AGENT_API: https://blackroad-agents.amundsonalexa.workers.dev | ||||||||||
|
|
||||||||||
| jobs: | ||||||||||
| # ============================================ | ||||||||||
| # Identify Affected Repositories | ||||||||||
| # ============================================ | ||||||||||
| identify-repos: | ||||||||||
| name: "Identify Affected Repos" | ||||||||||
| runs-on: ubuntu-latest | ||||||||||
| outputs: | ||||||||||
| repos: ${{ steps.find.outputs.repos }} | ||||||||||
| sync_files: ${{ steps.changes.outputs.files }} | ||||||||||
|
|
||||||||||
| steps: | ||||||||||
| - uses: actions/checkout@v4 | ||||||||||
| with: | ||||||||||
| fetch-depth: 2 | ||||||||||
|
|
||||||||||
| - name: Get Changed Files | ||||||||||
| id: changes | ||||||||||
| run: | | ||||||||||
| FILES=$(git diff --name-only HEAD~1 HEAD 2>/dev/null | head -50 || echo "") | ||||||||||
| echo "files<<EOF" >> $GITHUB_OUTPUT | ||||||||||
| echo "$FILES" >> $GITHUB_OUTPUT | ||||||||||
| echo "EOF" >> $GITHUB_OUTPUT | ||||||||||
|
|
||||||||||
| - name: Find Related Repositories | ||||||||||
| id: find | ||||||||||
| env: | ||||||||||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||
| run: | | ||||||||||
| # Default BlackRoad repos that should stay in sync | ||||||||||
| CORE_REPOS='[ | ||||||||||
| "BlackRoad-OS/blackroad-os-web", | ||||||||||
| "BlackRoad-OS/blackroad-os-docs", | ||||||||||
| "BlackRoad-OS/blackroad-cli", | ||||||||||
| "BlackRoad-OS/blackroad-agents", | ||||||||||
| "BlackRoad-OS/blackroad-os-mesh", | ||||||||||
| "BlackRoad-OS/blackroad-os-helper", | ||||||||||
| "BlackRoad-OS/blackroad-os-core" | ||||||||||
| ]' | ||||||||||
|
|
||||||||||
| if [ "${{ github.event.inputs.target_repos }}" = "all" ] || [ -z "${{ github.event.inputs.target_repos }}" ]; then | ||||||||||
| REPOS="$CORE_REPOS" | ||||||||||
| else | ||||||||||
| # Convert comma-separated to JSON array | ||||||||||
| REPOS=$(echo '${{ github.event.inputs.target_repos }}' | jq -R 'split(",") | map(gsub("^\\s+|\\s+$";""))') | ||||||||||
| fi | ||||||||||
|
|
||||||||||
| echo "repos=$REPOS" >> $GITHUB_OUTPUT | ||||||||||
| echo "Repos to sync: $REPOS" | ||||||||||
|
|
||||||||||
| # ============================================ | ||||||||||
| # Sync Workflows | ||||||||||
| # ============================================ | ||||||||||
| sync-workflows: | ||||||||||
| name: "Sync Workflows" | ||||||||||
| needs: identify-repos | ||||||||||
| if: github.event.inputs.sync_type == 'workflows' || github.event.inputs.sync_type == 'all' || contains(needs.identify-repos.outputs.sync_files, '.github/workflows') | ||||||||||
| runs-on: ubuntu-latest | ||||||||||
| strategy: | ||||||||||
| matrix: | ||||||||||
| repo: ${{ fromJSON(needs.identify-repos.outputs.repos) }} | ||||||||||
| fail-fast: false | ||||||||||
| max-parallel: 5 | ||||||||||
|
|
||||||||||
| steps: | ||||||||||
| - name: Checkout Source | ||||||||||
| uses: actions/checkout@v4 | ||||||||||
| with: | ||||||||||
| path: source | ||||||||||
|
|
||||||||||
| - name: Checkout Target | ||||||||||
| uses: actions/checkout@v4 | ||||||||||
| with: | ||||||||||
| repository: ${{ matrix.repo }} | ||||||||||
| path: target | ||||||||||
| token: ${{ secrets.CROSS_REPO_TOKEN || secrets.GITHUB_TOKEN }} | ||||||||||
|
|
||||||||||
| - name: Sync Workflow Files | ||||||||||
| run: | | ||||||||||
| # Copy autonomous workflows | ||||||||||
| mkdir -p target/.github/workflows | ||||||||||
|
|
||||||||||
| # Copy the orchestrator and self-healer | ||||||||||
| for workflow in autonomous-orchestrator.yml autonomous-self-healer.yml blackroad-agents.yml; do | ||||||||||
| if [ -f "source/.github/workflows-autonomous/$workflow" ]; then | ||||||||||
| cp "source/.github/workflows-autonomous/$workflow" "target/.github/workflows/" | ||||||||||
| elif [ -f "source/.github/workflows/$workflow" ]; then | ||||||||||
|
Comment on lines
+126
to
+128
|
||||||||||
| if [ -f "source/.github/workflows-autonomous/$workflow" ]; then | |
| cp "source/.github/workflows-autonomous/$workflow" "target/.github/workflows/" | |
| elif [ -f "source/.github/workflows/$workflow" ]; then | |
| if [ -f "source/.github/workflows/$workflow" ]; then |
Copilot
AI
Feb 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cross-repo workflow has a dry_run input parameter that defaults to true, but the condition checking for dry run uses github.event.inputs.dry_run != 'true'. For scheduled or push-triggered runs (not workflow_dispatch), github.event.inputs.dry_run will be empty/null, which != 'true', so the workflow will proceed with actual changes. This means the "safety" of dry_run being true by default only applies to manual runs, not automated ones.
Change the default behavior to be safe for automated runs. Use a condition like github.event.inputs.dry_run == 'false' so that changes only happen when explicitly set to false, or add a separate check to ensure automated runs don't make changes without explicit configuration.
| if: github.event.inputs.dry_run != 'true' | |
| if: github.event.inputs.dry_run == 'false' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cross-repo workflow hardcodes a list of specific BlackRoad repositories and attempts to sync workflows to them using a
CROSS_REPO_TOKENor fallback toGITHUB_TOKEN. However, the standardGITHUB_TOKENdoesn't have permissions to push to other repositories, so the fallback will always fail. Additionally, the workflow will attempt to sync to all seven hardcoded repositories regardless of whether this workflow is deployed in one of those repositories or in a completely different project, which could cause unexpected behavior or failures.When deployed to non-BlackRoad repositories, this should either:
The workflow should also validate that
CROSS_REPO_TOKENexists and has appropriate permissions before attempting cross-repo operations, and fail with a clear error message if it's missing.