Skip to content

Commit 96e442d

Browse files
committed
Initial Action
0 parents  commit 96e442d

31 files changed

+1487
-0
lines changed

.github/workflows/describe-pr.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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: Generate PR Description
17+
uses: augmentcode/describe-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/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: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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: Generate PR Description
19+
uses: augmentcode/describe-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_describe'
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 description 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-described']
48+
});
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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: Checkout
19+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20+
21+
- name: Generate PR Review
22+
uses: ./
23+
with:
24+
augment_session_auth: ${{ secrets.AUGMENT_SESSION_AUTH }}
25+
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
pull_number: ${{ github.event.pull_request.number }}
27+
repo_name: ${{ github.repository }}
28+
29+
- name: Remove trigger label
30+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
31+
with:
32+
script: |
33+
// Remove the trigger label after processing
34+
await github.rest.issues.removeLabel({
35+
owner: context.repo.owner,
36+
repo: context.repo.repo,
37+
issue_number: context.issue.number,
38+
name: 'augment_review'
39+
});
40+
41+
- name: Add completion label
42+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
43+
with:
44+
script: |
45+
// Add a label to indicate the review was generated
46+
await github.rest.issues.addLabels({
47+
owner: context.repo.owner,
48+
repo: context.repo.repo,
49+
issue_number: context.issue.number,
50+
labels: ['auto-reviewed']
51+
});

.github/workflows/release.yml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
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/review-pr@${{ steps.version.outputs.tag_name }}
66+
with:
67+
augment_api_token: ${{ secrets.AUGMENT_API_TOKEN }}
68+
augment_api_url: ${{ vars.AUGMENT_API_URL }}
69+
github_token: ${{ secrets.GITHUB_TOKEN }}
70+
pull_number: ${{ github.event.pull_request.number }}
71+
repo_name: ${{ github.repository }}
72+
```
73+
74+
### Major Version Tag
75+
You can also use the major version tag for automatic updates:
76+
```yaml
77+
- uses: augmentcode/review-pr@${{ steps.version.outputs.major_version }}
78+
```
79+
80+
### Documentation
81+
- 📖 [Full Documentation](https://github.com/augmentcode/review-pr#readme)
82+
- 🚀 [Quick Start Guide](https://github.com/augmentcode/review-pr#quick-start)
83+
- ⚙️ [Configuration Options](https://github.com/augmentcode/review-pr#inputs)
84+
- 💡 [Example Workflows](https://github.com/augmentcode/review-pr#example-workflows)
85+
EOF
86+
)
87+
88+
# Create the release using GitHub REST API
89+
echo "📡 Creating GitHub release..."
90+
RESPONSE=$(curl -s -w "%{http_code}" -L \
91+
-X POST \
92+
-H "Accept: application/vnd.github+json" \
93+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
94+
-H "X-GitHub-Api-Version: 2022-11-28" \
95+
https://api.github.com/repos/${{ github.repository }}/releases \
96+
-d "$(jq -n \
97+
--arg tag_name "${{ steps.version.outputs.tag_name }}" \
98+
--arg name "Release ${{ steps.version.outputs.tag_name }}" \
99+
--arg body "${RELEASE_BODY}" \
100+
'{
101+
"tag_name": $tag_name,
102+
"target_commitish": "main",
103+
"name": $name,
104+
"body": $body,
105+
"draft": false,
106+
"prerelease": false
107+
}')")
108+
109+
# Extract HTTP status code (last 3 characters)
110+
HTTP_CODE="${RESPONSE: -3}"
111+
RESPONSE_BODY="${RESPONSE%???}"
112+
113+
# Check if the request was successful
114+
if [ "$HTTP_CODE" -eq 201 ]; then
115+
echo "✅ Successfully created release ${{ steps.version.outputs.tag_name }}"
116+
117+
# Extract and display the release URL if available
118+
RELEASE_URL=$(echo "$RESPONSE_BODY" | jq -r '.html_url // empty')
119+
if [ -n "$RELEASE_URL" ]; then
120+
echo "🔗 Release URL: $RELEASE_URL"
121+
fi
122+
123+
echo "🎉 Release process completed successfully!"
124+
else
125+
echo "❌ Failed to create release. HTTP status: $HTTP_CODE"
126+
echo "Response: $RESPONSE_BODY"
127+
exit 1
128+
fi

.github/workflows/review-pr.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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: Checkout
17+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
- name: Generate PR Review
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 }}

0 commit comments

Comments
 (0)