Skip to content

Sync from Intelligence Flow #20

Sync from Intelligence Flow

Sync from Intelligence Flow #20

Workflow file for this run

name: Sync from Intelligence Flow
on:
schedule:
- cron: "23 */6 * * *"
workflow_dispatch:
inputs:
source_commit:
description: Exact Intelligence Flow commit dispatched by Operator Stack Publisher
required: false
type: string
permissions:
contents: write
pull-requests: write
concurrency:
group: sync-intelligence-flow
cancel-in-progress: false
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Create Operator Stack Publisher token
id: publisher-token
uses: actions/create-github-app-token@v3
with:
client-id: ${{ vars.OPERATOR_STACK_PUBLISHER_APP_CLIENT_ID || vars.BOATSTACK_APP_CLIENT_ID }}
private-key: ${{ secrets.OPERATOR_STACK_PUBLISHER_APP_PRIVATE_KEY || secrets.BOATSTACK_APP_PRIVATE_KEY }}
owner: operatorstack
repositories: value-map
permission-contents: read
permission-pull-requests: write
- name: Check out Value Map
uses: actions/checkout@v4
with:
path: value-map-repo
- name: Check out Intelligence Flow
uses: actions/checkout@v4
with:
repository: operatorstack/intelligence-flow
ref: ${{ inputs.source_commit || 'main' }}
path: intelligence-flow
fetch-depth: 0
- name: Project canonical skill
id: project
shell: bash
run: |
if [[ -n "${{ inputs.source_commit }}" ]]; then
source_commit="$(git -C intelligence-flow rev-parse HEAD)"
else
source_commit="$(git -C intelligence-flow log -1 --format=%H -- labs/14-product-value-projection)"
fi
python3 value-map-repo/scripts/project_upstream.py \
--source intelligence-flow \
--repo value-map-repo \
--commit "$source_commit" \
--write
echo "source_commit=$source_commit" >> "$GITHUB_OUTPUT"
- name: Open generated pull request
env:
GH_TOKEN: ${{ steps.publisher-token.outputs.token }}
SOURCE_COMMIT: ${{ steps.project.outputs.source_commit }}
shell: bash
run: |
cd value-map-repo
if [[ -z "$(git status --porcelain)" ]]; then
echo "Value Map already matches Intelligence Flow."
exit 0
fi
short="${SOURCE_COMMIT:0:12}"
branch="sync/intelligence-flow-$short"
existing="$(gh pr list --head "$branch" --state open --json url --jq '.[0].url')"
if [[ -n "$existing" ]]; then
echo "Upstream PR already open: $existing"
gh pr merge "$existing" --auto --squash
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -B "$branch"
git add value-map/SKILL.md UPSTREAM.json
git commit -m "Sync Value Map from Intelligence Flow $short"
git push --force --set-upstream origin "$branch"
pr_url="$(gh pr create \
--base main \
--head "$branch" \
--title "Sync Value Map from Intelligence Flow $short" \
--body "Generated from operatorstack/intelligence-flow@$SOURCE_COMMIT. Review the operator contract, provenance, and compatibility checks before merging.")"
gh pr merge "$pr_url" --auto --squash