Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ jobs:
cache: pnpm
- name: Authenticate to NPM registry
run: |
npm install -g @vertesia/cli
npm install -g @vertesia/cli@0.50.1
vertesia --version
vertesia profiles create "${VT_PROFILE}" \
--target "${VT_ENV}" \
--account "${VT_ACCOUNT}" \
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,5 @@ dist

# Vertesia
lib/
.npmrc
.npmrc
.turbo
4 changes: 2 additions & 2 deletions apps/github-agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"@temporalio/activity": "1.11.7",
"@temporalio/worker": "1.11.7",
"@temporalio/workflow": "1.11.7",
"@vertesia/client": "^0.55.0",
"@vertesia/common": "^0.55.0",
"@vertesia/client": "0.50.1",
"@vertesia/common": "0.50.1",
"octokit": "4.1.2"
}
}
20 changes: 1 addition & 19 deletions apps/github-agent/src/workflows/parser.test.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
import { expect, test } from 'vitest';
import {
parseIssueIdFromBranch,
parseIssueIdsFromComment,
} from './parser';
import { GithubIssueRef } from './types.js';

test('Parse issue ID from Git branch', async () => {
expect(parseIssueIdFromBranch({
org: 'vertesia',
repo: 'studio',
branch: 'feat/123/my-feature',
})).toEqual(new GithubIssueRef('vertesia', 'studio', 123));

expect(parseIssueIdFromBranch({
org: 'vertesia',
repo: 'studio',
branch: 'feat-123',
})).toEqual(new GithubIssueRef('vertesia', 'studio', 123));
});
import { parseIssueIdsFromComment } from './parser';

test('Parse issue ID from comment', async () => {
expect(parseIssueIdsFromComment({
Expand Down
19 changes: 1 addition & 18 deletions apps/github-agent/src/workflows/parser.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
import { GithubIssueRef } from './types.js';

export function parseIssueIdFromBranch({ org, repo, branch }: { org: string, repo: string, branch: string }): GithubIssueRef | undefined {
const match = branch.match(/(\d+)/);
if (match === null) {
return undefined;
}
const number = parseInt(match[1], 10);
if (isNaN(number)) {
return undefined;
}
return new GithubIssueRef(org, repo, number);
}

export function parseIssueIdsFromComment({ org, repo, comment }: { org: string, repo: string, comment: string }): Record<string, GithubIssueRef> {
// key: html URL, value: issue reference
const issues: Record<string, GithubIssueRef> = {};
Expand Down Expand Up @@ -44,12 +32,7 @@ export function parseIssueIdsFromComment({ org, repo, comment }: { org: string,
return issues;
}

export function parseIssuesFromPullRequest({ org, repo, branch, body }: { org: string, repo: string, branch: string, body: string }): GithubIssueRef[] {
export function parseIssuesFromPullRequest({ org, repo, body }: { org: string, repo: string, body: string }): GithubIssueRef[] {
const issues = parseIssueIdsFromComment({ org, repo, comment: body });
const issue = parseIssueIdFromBranch({ org, repo, branch });
if (issue !== undefined) {
issues[issue.toHtmlUrl()] = issue;
}

return Object.values(issues);
}
1 change: 0 additions & 1 deletion apps/github-agent/src/workflows/review-pull-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,6 @@ async function loadGithubIssues(ctx: AssistantContext) {
const issueRefs = parseIssuesFromPullRequest({
org: ctx.pullRequest.org,
repo: ctx.pullRequest.repo,
branch: ctx.pullRequest.branch,
body: ctx.pullRequest.body,
});
log.info(`Found ${issueRefs.length} GitHub issues in the pull request`, { pull_request_ctx: ctx, issue_refs: issueRefs });
Expand Down
70 changes: 18 additions & 52 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.