Skip to content

Add reusable workflows for cross-repo Copilot artifact synchronization#1

Merged
einari merged 3 commits intomainfrom
copilot/add-workflows-for-copilot-artifacts
Mar 1, 2026
Merged

Add reusable workflows for cross-repo Copilot artifact synchronization#1
einari merged 3 commits intomainfrom
copilot/add-workflows-for-copilot-artifacts

Conversation

Copy link
Contributor

Copilot AI commented Mar 1, 2026

Centralizes Copilot instruction sync logic in Cratis/Workflows so all repos delegate here rather than each maintaining their own copy.

Important

These workflows are for use by the Cratis organization only. Runtime validation rejects calls from outside the org.

Reusable workflows

  • sync-copilot-instructions.yml (workflow_call) — clones a source_repository, copies .github/copilot-instructions.md, .github/instructions/, and .github/agents/, then opens a PR in the calling repo. Input validated against injection-safe regex and must belong to the Cratis organization.
  • propagate-copilot-instructions.yml (workflow_call) — lists all Cratis repos and fires sync-copilot-instructions.yml in each (skipping the caller to prevent loops). Uses a job-level if: github.repository_owner == 'Cratis' guard to silently skip runs from outside the org.

Bootstrap

  • bootstrap-copilot-sync.yml (workflow_dispatch) — one-shot workflow that opens PRs in every non-archived Cratis repo adding two thin wrappers:
# sync wrapper (workflow_dispatch)
jobs:
  sync:
    uses: Cratis/Workflows/.github/workflows/sync-copilot-instructions.yml@main
    with:
      source_repository: ${{ inputs.source_repository }}
    secrets: inherit

# propagate wrapper (push to main on copilot paths)
jobs:
  propagate:
    uses: Cratis/Workflows/.github/workflows/propagate-copilot-instructions.yml@main
    secrets: inherit

Idempotent — skips repos where the PR branch already exists. Requires PAT_DOCUMENTATION secret with repo scope.

Documentation

README.md includes a getting-started section for Cratis repositories, a Mermaid sequence diagram for the end-to-end propagation flow, a Mermaid flowchart for the sync workflow internals, and a per-workflow reference table.

Original prompt

We want workflows that can be used by all of our repositories to synchronize copilot artifacts between the repositories on change.

We’ve built this as a PR that you can put here instead of: Cratis/Chronicle#2422

When done, create a PR in all the repositories in the Cratis organization with the workflows needed for this to work - these workflows should just include the ones here so that we can maintain the workflows in one place.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: einari <134365+einari@users.noreply.github.com>
Copilot AI changed the title [WIP] Add workflows for synchronizing Copilot artifacts Add reusable workflows for cross-repo Copilot artifact synchronization Mar 1, 2026
@einari einari marked this pull request as ready for review March 1, 2026 12:51
@einari
Copy link
Contributor

einari commented Mar 1, 2026

@copilot great. Add documentation in the readme file for how this works. If needed, add mermaid drawings. At the top har a section of how to get started with your Cratis repository - make it very clear that this is for Cratis only.

In fact, we should have validation in the jobs - if the origin is not from the Cratis org - we should ignore it

Co-authored-by: einari <134365+einari@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 1, 2026

@copilot great. Add documentation in the readme file for how this works. If needed, add mermaid drawings. At the top har a section of how to get started with your Cratis repository - make it very clea...

Done in c2d711b.

Cratis-org validation:

  • sync-copilot-instructions.yml — extracts the owner from source_repository and exits with an error if it isn't Cratis
  • propagate-copilot-instructions.yml — uses a job-level if: ${{ github.repository_owner == 'Cratis' }} guard so the entire job is skipped (not just a step) when called from outside the org

README — rewrote with:

  • A prominent [!IMPORTANT] callout at the top making clear this is Cratis-only
  • A Getting started section showing the exact wrapper workflow files to add, with the note that the bootstrap workflow can do it automatically
  • A Mermaid sequence diagram for the end-to-end propagation flow
  • A Mermaid flowchart detailing the sync workflow logic
  • A reference section for each workflow (trigger, inputs, secrets required)

@einari einari merged commit d0b6ef5 into main Mar 1, 2026
@einari einari deleted the copilot/add-workflows-for-copilot-artifacts branch March 1, 2026 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants