Skip to content

Commit 79bb1d2

Browse files
committed
Initial Action
0 parents  commit 79bb1d2

31 files changed

+1398
-0
lines changed

.github/workflows/describe-pr.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Basic PR Description Generation
2+
# Automatically generates AI-powered descriptions for new pull requests
3+
4+
name: Auto-describe PRs
5+
on:
6+
pull_request:
7+
types: [opened]
8+
9+
jobs:
10+
describe:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
pull-requests: write
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
- name: Generate PR Description
19+
uses: ./
20+
with:
21+
augment_session_auth: ${{ secrets.AUGMENT_SESSION_AUTH }}
22+
github_token: ${{ secrets.GITHUB_TOKEN }}
23+
pull_number: ${{ github.event.pull_request.number }}
24+
repo_name: ${{ github.repository }}

.github/workflows/format-check.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Format Check
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize]
9+
branches:
10+
- main
11+
12+
jobs:
13+
format-check:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
19+
- name: Setup Bun
20+
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2
21+
with:
22+
bun-version: latest
23+
24+
- name: Install dependencies
25+
run: bun install --frozen-lockfile
26+
27+
- name: Check formatting
28+
run: bun run format:check
29+
30+
- name: Check if files would change
31+
run: |
32+
if ! git diff --exit-code; then
33+
echo "❌ Files are not properly formatted. Run 'bun run format' to fix."
34+
exit 1
35+
else
36+
echo "✅ All files are properly formatted."
37+
fi
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# On-Demand PR Description
2+
# Generates descriptions when the "augment_describe" label is added to a PR
3+
4+
name: On-Demand PR Description
5+
on:
6+
pull_request:
7+
types: [labeled]
8+
9+
jobs:
10+
describe:
11+
# Only run when the specific label is added
12+
if: github.event.label.name == 'augment_describe'
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20+
- name: Generate PR Description
21+
uses: ./
22+
with:
23+
augment_session_auth: ${{ secrets.AUGMENT_SESSION_AUTH }}
24+
github_token: ${{ secrets.GITHUB_TOKEN }}
25+
pull_number: ${{ github.event.pull_request.number }}
26+
repo_name: ${{ github.repository }}
27+
28+
- name: Remove trigger label
29+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
30+
with:
31+
script: |
32+
// Remove the trigger label after processing
33+
await github.rest.issues.removeLabel({
34+
owner: context.repo.owner,
35+
repo: context.repo.repo,
36+
issue_number: context.issue.number,
37+
name: 'augment_describe'
38+
});
39+
40+
- name: Add completion label
41+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
42+
with:
43+
script: |
44+
// Add a label to indicate the description was generated
45+
await github.rest.issues.addLabels({
46+
owner: context.repo.owner,
47+
repo: context.repo.repo,
48+
issue_number: context.issue.number,
49+
labels: ['auto-described']
50+
});
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# On-Demand PR Review
2+
# Generates reviews when the "augment_review" label is added to a PR
3+
4+
name: On-Demand PR Review
5+
on:
6+
pull_request:
7+
types: [labeled]
8+
9+
jobs:
10+
review:
11+
# Only run when the specific label is added
12+
if: github.event.label.name == 'augment_review'
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
steps:
18+
- name: Generate PR Review
19+
uses: augmentcode/review-pr@v0
20+
with:
21+
augment_session_auth: ${{ secrets.AUGMENT_SESSION_AUTH }}
22+
github_token: ${{ secrets.GITHUB_TOKEN }}
23+
pull_number: ${{ github.event.pull_request.number }}
24+
repo_name: ${{ github.repository }}
25+
26+
- name: Remove trigger label
27+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
28+
with:
29+
script: |
30+
// Remove the trigger label after processing
31+
await github.rest.issues.removeLabel({
32+
owner: context.repo.owner,
33+
repo: context.repo.repo,
34+
issue_number: context.issue.number,
35+
name: 'augment_review'
36+
});
37+
38+
- name: Add completion label
39+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
40+
with:
41+
script: |
42+
// Add a label to indicate the review was generated
43+
await github.rest.issues.addLabels({
44+
owner: context.repo.owner,
45+
repo: context.repo.repo,
46+
issue_number: context.issue.number,
47+
labels: ['auto-reviewed']
48+
});

.github/workflows/pr-review.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Basic PR Review Generation
2+
# Automatically generates AI-powered reviews for new pull requests
3+
4+
name: Auto-review PRs
5+
on:
6+
pull_request:
7+
types: [opened]
8+
9+
jobs:
10+
review:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
pull-requests: write
15+
steps:
16+
- name: Generate PR Review
17+
uses: augmentcode/review-pr@v0
18+
with:
19+
augment_session_auth: ${{ secrets.AUGMENT_SESSION_AUTH }}
20+
github_token: ${{ secrets.GITHUB_TOKEN }}
21+
pull_number: ${{ github.event.pull_request.number }}
22+
repo_name: ${{ github.repository }}

.github/workflows/release.yml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
permissions:
9+
contents: write
10+
packages: write
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
with:
20+
fetch-depth: 0
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Setup Bun
24+
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2
25+
with:
26+
bun-version: latest
27+
28+
- name: Install dependencies
29+
run: bun install
30+
31+
- name: Extract version from tag
32+
id: version
33+
run: |
34+
TAG_NAME=${GITHUB_REF#refs/tags/}
35+
VERSION=${TAG_NAME#v}
36+
MAJOR_VERSION=$(echo $VERSION | cut -d. -f1)
37+
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
38+
echo "version=$VERSION" >> $GITHUB_OUTPUT
39+
echo "major_version=v$MAJOR_VERSION" >> $GITHUB_OUTPUT
40+
41+
- name: Verify package.json version matches tag
42+
run: |
43+
PACKAGE_VERSION=$(jq -r '.version' package.json)
44+
if [ "$PACKAGE_VERSION" != "${{ steps.version.outputs.version }}" ]; then
45+
echo "❌ Version mismatch: package.json has $PACKAGE_VERSION but tag is ${{ steps.version.outputs.version }}"
46+
exit 1
47+
fi
48+
echo "✅ Version verified: $PACKAGE_VERSION"
49+
50+
- name: Update major version tag
51+
run: |
52+
git config --global user.name "github-actions[bot]"
53+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
54+
git tag -f "${{ steps.version.outputs.major_version }}" -m "Release ${{ steps.version.outputs.major_version }} (latest)"
55+
git push origin "${{ steps.version.outputs.major_version }}" --force
56+
57+
- name: Create GitHub Release
58+
run: |
59+
# Create release body content
60+
RELEASE_BODY=$(cat << 'EOF'
61+
## Release ${{ steps.version.outputs.tag_name }}
62+
63+
### Quick Usage
64+
```yaml
65+
- uses: augmentcode/describe-pr@${{ steps.version.outputs.tag_name }}
66+
with:
67+
augment_session_auth: ${{ secrets.AUGMENT_SESSION_AUTH }}
68+
github_token: ${{ secrets.GITHUB_TOKEN }}
69+
pull_number: ${{ github.event.pull_request.number }}
70+
repo_name: ${{ github.repository }}
71+
```
72+
73+
### Major Version Tag
74+
You can also use the major version tag for automatic updates:
75+
```yaml
76+
- uses: augmentcode/describe-pr@${{ steps.version.outputs.major_version }}
77+
```
78+
79+
### Documentation
80+
- 📖 [Full Documentation](https://github.com/augmentcode/describe-pr#readme)
81+
- 🚀 [Quick Start Guide](https://github.com/augmentcode/describe-pr#quick-start)
82+
- ⚙️ [Configuration Options](https://github.com/augmentcode/describe-pr#inputs)
83+
- 💡 [Example Workflows](https://github.com/augmentcode/describe-pr#example-workflows)
84+
EOF
85+
)
86+
87+
# Create the release using GitHub REST API
88+
echo "📡 Creating GitHub release..."
89+
RESPONSE=$(curl -s -w "%{http_code}" -L \
90+
-X POST \
91+
-H "Accept: application/vnd.github+json" \
92+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
93+
-H "X-GitHub-Api-Version: 2022-11-28" \
94+
https://api.github.com/repos/${{ github.repository }}/releases \
95+
-d "$(jq -n \
96+
--arg tag_name "${{ steps.version.outputs.tag_name }}" \
97+
--arg name "Release ${{ steps.version.outputs.tag_name }}" \
98+
--arg body "${RELEASE_BODY}" \
99+
'{
100+
"tag_name": $tag_name,
101+
"target_commitish": "main",
102+
"name": $name,
103+
"body": $body,
104+
"draft": false,
105+
"prerelease": false
106+
}')")
107+
108+
# Extract HTTP status code (last 3 characters)
109+
HTTP_CODE="${RESPONSE: -3}"
110+
RESPONSE_BODY="${RESPONSE%???}"
111+
112+
# Check if the request was successful
113+
if [ "$HTTP_CODE" -eq 201 ]; then
114+
echo "✅ Successfully created release ${{ steps.version.outputs.tag_name }}"
115+
116+
# Extract and display the release URL if available
117+
RELEASE_URL=$(echo "$RESPONSE_BODY" | jq -r '.html_url // empty')
118+
if [ -n "$RELEASE_URL" ]; then
119+
echo "🔗 Release URL: $RELEASE_URL"
120+
fi
121+
122+
echo "🎉 Release process completed successfully!"
123+
else
124+
echo "❌ Failed to create release. HTTP status: $HTTP_CODE"
125+
echo "Response: $RESPONSE_BODY"
126+
exit 1
127+
fi

0 commit comments

Comments
 (0)