Merge pull request #921 from fullsend-ai/agent/920-dynamic-gitlab-hos… #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Notify the .fullsend repo to sync agent digests across all fullsend-ai | |
| # repos whenever agents main is updated. | |
| # | |
| # Cross-repo contract (consumer: fullsend-ai/.fullsend/.github/workflows/sync-agent-digests.yml): | |
| # event_type: agents-updated | |
| # client_payload: { sha: <40-char commit SHA of agents main> } | |
| # Note: consumer currently re-resolves HEAD independently via API; | |
| # the sha payload is informational for audit/logging purposes. | |
| # | |
| # Required setup: | |
| # 1. Set repository variable SYNC_CLIENT_ID to the fullsend-ai-sync App Client ID. | |
| # 2. Set repository secret SYNC_PRIVATE_KEY to the App's PEM private key. | |
| # 3. Set repository secret SLACK_WEBHOOK_URL for failure notifications. | |
| name: Notify Agent Sync | |
| on: | |
| push: | |
| branches: [main] | |
| paths-ignore: | |
| - '.fullsend/**' | |
| workflow_dispatch: {} | |
| permissions: {} | |
| jobs: | |
| notify: | |
| if: github.repository_owner == 'fullsend-ai' && github.actor != 'fullsend-ai-sync[bot]' | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 5 | |
| permissions: {} | |
| steps: | |
| - uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 | |
| id: app-token | |
| with: | |
| client-id: ${{ vars.SYNC_CLIENT_ID }} | |
| private-key: ${{ secrets.SYNC_PRIVATE_KEY }} | |
| repositories: .fullsend | |
| permission-contents: write | |
| - name: Dispatch sync | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| COMMIT_SHA: ${{ github.sha }} | |
| run: | | |
| set -euo pipefail | |
| gh api repos/fullsend-ai/.fullsend/dispatches \ | |
| -f event_type=agents-updated \ | |
| -f "client_payload[sha]=${COMMIT_SHA}" | |
| notify-failure: | |
| needs: [notify] | |
| if: always() && needs.notify.result != 'success' && needs.notify.result != 'skipped' | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 5 | |
| permissions: {} | |
| steps: | |
| - name: Notify Slack | |
| env: | |
| SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| run: | | |
| set -euo pipefail | |
| if [[ -z "${SLACK_WEBHOOK}" ]]; then | |
| echo "::error::SLACK_WEBHOOK_URL secret is not configured" | |
| exit 1 | |
| fi | |
| PAYLOAD=$(jq -n --arg url "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" \ | |
| '{text: ":warning: Agent digest sync dispatch to .fullsend failed — the sync itself was never started. <\($url)|View run>"}') | |
| curl -fsS -X POST -H "Content-Type: application/json" -d "$PAYLOAD" "$SLACK_WEBHOOK" |