-
-
Notifications
You must be signed in to change notification settings - Fork 2
140 lines (119 loc) · 4.97 KB
/
Copy pathrelease-content.yml
File metadata and controls
140 lines (119 loc) · 4.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Release Content - Auto-generate announcements
on:
release:
types:
- published
workflow_dispatch:
inputs:
tag:
description: Release tag to announce
required: true
type: string
permissions:
contents: read
discussions: write
jobs:
announce:
runs-on: ubuntu-latest
env:
GH_REPO: ${{ github.repository }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: ${{ github.event.inputs.tag || github.event.release.tag_name }}
fetch-depth: 0 # full history for changelog
- name: Get release info
id: release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ github.event.inputs.tag || github.event.release.tag_name }}
run: |
TAG="$RELEASE_TAG"
if [ -z "$TAG" ]; then
echo "Release tag missing" >&2
exit 1
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
# Find previous published release, not merely the previous raw git tag.
PREV_TAG="$(gh release list --exclude-drafts --exclude-pre-releases --json tagName --jq '.[].tagName' | awk -v current="$TAG" '$0 != current { print; exit }')"
if [ -z "$PREV_TAG" ]; then
PREV_TAG=$(git rev-list --max-parents=0 HEAD)
fi
echo "prev_tag=$PREV_TAG" >> "$GITHUB_OUTPUT"
# Generate changelog.
CHANGELOG=$(git log --oneline "$PREV_TAG".."$TAG" -- sdk/ | head -20)
echo "changelog<<EOF" >> "$GITHUB_OUTPUT"
echo "$CHANGELOG" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Create GitHub Discussion
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ steps.release.outputs.tag }}
CHANGELOG: ${{ steps.release.outputs.changelog }}
PREV_TAG: ${{ steps.release.outputs.prev_tag }}
run: |
BODY_FILE="$(mktemp)"
CATEGORY_FILE="$(mktemp)"
trap 'rm -f "$BODY_FILE" "$CATEGORY_FILE"' EXIT
{
printf '## AgentGuard %s Released\n\n' "$TAG"
printf 'Install or upgrade:\n'
printf '```bash\n'
printf 'pip install --upgrade agentguard47\n'
printf '```\n\n'
printf '### What changed\n'
printf '%s\n\n' "$CHANGELOG"
printf -- '---\n'
printf 'Full changelog: https://github.com/bmdhodl/agent47/compare/%s...%s\n\n' "$PREV_TAG" "$TAG"
printf 'PyPI: https://pypi.org/project/agentguard47/\n'
} > "$BODY_FILE"
REPOSITORY_ID="$(gh api repos/bmdhodl/agent47 --jq '.node_id')"
if ! gh api repos/bmdhodl/agent47/discussions/categories > "$CATEGORY_FILE" 2>/dev/null; then
echo "Discussion creation skipped (categories unavailable or Discussions disabled)"
exit 0
fi
if ! CATEGORY_ID="$(python scripts/resolve_discussion_category.py < "$CATEGORY_FILE")"; then
echo "Discussion creation skipped (no Announcements category)"
exit 0
fi
gh api graphql -f query='
mutation($repositoryId: ID!, $categoryId: ID!, $title: String!, $body: String!) {
createDiscussion(input: {
repositoryId: $repositoryId
categoryId: $categoryId
title: $title
body: $body
}) { discussion { url } }
}' \
-f repositoryId="$REPOSITORY_ID" \
-f categoryId="$CATEGORY_ID" \
-f title="AgentGuard $TAG released" \
-f body="$(cat "$BODY_FILE")"
- name: Add to social queue (dashboard repo)
env:
GH_TOKEN: ${{ secrets.DASHBOARD_PAT }}
run: |
TAG="${{ steps.release.outputs.tag }}"
# Skip if no DASHBOARD_PAT configured.
if [ -z "$GH_TOKEN" ]; then
echo "No DASHBOARD_PAT - skipping social queue"
exit 0
fi
# Trigger X post.
gh workflow run add-social-post.yml \
--repo bmdhodl/agent47-dashboard \
-f platform=x \
-f title="$TAG released" \
-f body="agentguard $TAG is out.
pip install --upgrade agentguard47
changelog: https://github.com/bmdhodl/agent47/releases/tag/$TAG" || echo "Failed to trigger X post workflow"
# Trigger LinkedIn post.
gh workflow run add-social-post.yml \
--repo bmdhodl/agent47-dashboard \
-f platform=linkedin \
-f title="$TAG released" \
-f body="AgentGuard $TAG is now available on PyPI.
Runtime guardrails for AI agents - loop detection, budget enforcement, cost tracking. Zero dependencies.
Upgrade: pip install --upgrade agentguard47
Changelog: https://github.com/bmdhodl/agent47/releases/tag/$TAG
Repo: https://github.com/bmdhodl/agent47" || echo "Failed to trigger LinkedIn post workflow"