Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
a1627aa
add execution role export
anthony-nhs Sep 18, 2025
3505043
Merge remote-tracking branch 'origin/main' into pull_request_conversa…
anthony-nhs Sep 18, 2025
54f3cd5
start adding import
anthony-nhs Sep 18, 2025
416f487
fix cdk
anthony-nhs Sep 18, 2025
8b5875c
remove unused prop
anthony-nhs Sep 18, 2025
175460e
add policy
anthony-nhs Sep 18, 2025
655b5da
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Sep 18, 2025
512ea4d
add export for slackbot
anthony-nhs Sep 18, 2025
00ab481
permissions for cloudformation
anthony-nhs Sep 18, 2025
a6755c1
fix it
anthony-nhs Sep 18, 2025
2953af7
handle pull request id in chat
anthony-nhs Sep 18, 2025
23b7b7b
fix import name
anthony-nhs Sep 18, 2025
dd8ca83
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Sep 18, 2025
de5e4dc
get the lambda arn
anthony-nhs Sep 18, 2025
4a13592
pull request id for dm
anthony-nhs Sep 18, 2025
bbbecb7
dont thread dm
anthony-nhs Sep 18, 2025
d590dd6
better export
anthony-nhs Sep 18, 2025
c95313f
fix policy
anthony-nhs Sep 18, 2025
487817a
add some typing
anthony-nhs Sep 18, 2025
a8cbc00
trigger lambda
anthony-nhs Sep 18, 2025
519b0dd
invoke with a string
anthony-nhs Sep 18, 2025
0ed27ce
have a common refactor of code
anthony-nhs Sep 18, 2025
2f98b49
send correct body
anthony-nhs Sep 18, 2025
fe508a2
pass body to lambda
anthony-nhs Sep 18, 2025
fcc45a0
do pull request as async
anthony-nhs Sep 19, 2025
2180e30
update gitallowed
anthony-nhs Sep 19, 2025
97ea714
refactor a bit
anthony-nhs Sep 19, 2025
a9f5cca
more typing
anthony-nhs Sep 19, 2025
401010a
more typing
anthony-nhs Sep 19, 2025
eecb605
even more typing
anthony-nhs Sep 19, 2025
0214e76
handle pull requests
anthony-nhs Sep 19, 2025
438f1d0
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Sep 19, 2025
0a60cce
trigger processing correctly
anthony-nhs Sep 19, 2025
1616d9c
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Sep 19, 2025
3688e08
strip mentions
anthony-nhs Sep 19, 2025
fd1a552
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Sep 19, 2025
fd6298a
no need to strip mentions
anthony-nhs Sep 19, 2025
56542fb
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Sep 19, 2025
7d861ff
more types
anthony-nhs Sep 19, 2025
9d34500
more fixing type
anthony-nhs Sep 19, 2025
be68283
more types
anthony-nhs Sep 19, 2025
33de463
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Sep 19, 2025
444a8fd
fix type
anthony-nhs Sep 19, 2025
319076a
more refactor
anthony-nhs Sep 19, 2025
dbb655d
error handling
anthony-nhs Sep 19, 2025
d2f73af
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Sep 19, 2025
7a160ec
more test
anthony-nhs Sep 22, 2025
5f6eb83
Merge remote-tracking branch 'origin/main' into pull_request_conversa…
anthony-nhs Sep 22, 2025
d73e6d5
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Sep 22, 2025
ed37e7b
post error message
anthony-nhs Sep 24, 2025
4b452cd
use proper lazy handling
anthony-nhs Sep 24, 2025
04c250e
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Sep 24, 2025
acab870
correct pr processing
anthony-nhs Sep 24, 2025
6046de1
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Sep 24, 2025
d29cb31
fix params
anthony-nhs Sep 24, 2025
35b4760
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Sep 24, 2025
6ca85f2
handle action events properly
anthony-nhs Sep 24, 2025
aa78d0c
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Sep 24, 2025
c84437e
Merge remote-tracking branch 'origin/main' into pull_request_conversa…
anthony-nhs Oct 6, 2025
3b38838
use threads for direct messages
anthony-nhs Oct 6, 2025
219b5cc
store pull request id
anthony-nhs Oct 6, 2025
d285c52
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Oct 6, 2025
0040e3c
fix complexity
anthony-nhs Oct 6, 2025
64cfaf1
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Oct 6, 2025
d2b845a
get token for pull requests
anthony-nhs Oct 6, 2025
4de8cae
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Oct 6, 2025
52534e4
fix secret pre commit
anthony-nhs Oct 6, 2025
9bcac78
wip to forward event
anthony-nhs Oct 6, 2025
b631475
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Oct 6, 2025
5d76549
fix test
anthony-nhs Oct 6, 2025
4f678d5
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Oct 6, 2025
5b70ea3
a refactor
anthony-nhs Oct 7, 2025
bc87c98
more refactor
anthony-nhs Oct 7, 2025
a4192ef
move all handling to slack_events
anthony-nhs Oct 7, 2025
b757ee3
proper pull request handling
anthony-nhs Oct 7, 2025
4333043
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Oct 7, 2025
707203c
strip text before forwarding
anthony-nhs Oct 7, 2025
fe432d2
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Oct 7, 2025
97c02a0
working pull request
anthony-nhs Oct 7, 2025
f70e01e
tidy up slack handlers
anthony-nhs Oct 7, 2025
8e094ce
common function to get lambda arn
anthony-nhs Oct 7, 2025
abaeb7e
first tests working
anthony-nhs Oct 7, 2025
f6fb78d
rename file
anthony-nhs Oct 7, 2025
46f87a4
more test
anthony-nhs Oct 7, 2025
17af6a2
another test
anthony-nhs Oct 7, 2025
c0ef9a8
another test
anthony-nhs Oct 7, 2025
5864f99
more tests
anthony-nhs Oct 7, 2025
d5e852e
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Oct 7, 2025
0d0468d
sonar fix
anthony-nhs Oct 7, 2025
5af2a54
some more tests
anthony-nhs Oct 7, 2025
9eb2532
more test
anthony-nhs Oct 7, 2025
e906af8
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Oct 7, 2025
0842516
handle mentions and messages correctly
anthony-nhs Oct 7, 2025
352a3cd
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Oct 7, 2025
63bb894
different response on here
anthony-nhs Oct 7, 2025
1bc42f5
fix mentions
anthony-nhs Oct 7, 2025
31087b4
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Oct 7, 2025
810d77d
fix test
anthony-nhs Oct 7, 2025
c3fa6e8
Merge branch 'pull_request_conversation_1' into pull_request_conversa…
anthony-nhs Oct 7, 2025
e5c9265
Merge remote-tracking branch 'origin/main' into pull_request_conversa…
anthony-nhs Oct 9, 2025
db2b012
make it mergable
anthony-nhs Oct 9, 2025
6e2210f
sync to main
anthony-nhs Oct 9, 2025
98cc3f4
fix import name
anthony-nhs Oct 9, 2025
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
28 changes: 27 additions & 1 deletion packages/cdk/resources/Functions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Construct} from "constructs"
import {LambdaFunction} from "../constructs/LambdaFunction"
import {ManagedPolicy} from "aws-cdk-lib/aws-iam"
import {ManagedPolicy, PolicyStatement, Role} from "aws-cdk-lib/aws-iam"
import {StringParameter} from "aws-cdk-lib/aws-ssm"
import {Secret} from "aws-cdk-lib/aws-secretsmanager"
import {TableV2} from "aws-cdk-lib/aws-dynamodb"
Expand Down Expand Up @@ -35,6 +35,8 @@ export interface FunctionsProps {
readonly slackBotSigningSecret: Secret
readonly slackBotStateTable: TableV2
readonly promptName: string
readonly isPullRequest: boolean
readonly mainSlackBotLambdaExecutionRoleArn : string
}

export class Functions extends Construct {
Expand Down Expand Up @@ -74,6 +76,30 @@ export class Functions extends Construct {
props.slackBotTokenSecret.grantRead(slackBotLambda.function)
props.slackBotSigningSecret.grantRead(slackBotLambda.function)

if (props.isPullRequest) {
const mainSlackBotLambdaExecutionRole = Role.fromRoleArn(
this,
"mainRoleArn",
props.mainSlackBotLambdaExecutionRoleArn, {
mutable: true
})

const executeSlackBotPolicy = new ManagedPolicy(this, "ExecuteSlackBotPolicy", {
description: "foo",
statements: [
new PolicyStatement({
actions: [
"lambda:invokeFunction"
],
resources: [
slackBotLambda.function.functionArn
]
})
]
})
mainSlackBotLambdaExecutionRole.addManagedPolicy(executeSlackBotPolicy)
}

// Lambda function to sync knowledge base on S3 events
const syncKnowledgeBaseFunction = new LambdaFunction(this, "SyncKnowledgeBaseFunction", {
stackName: props.stackName,
Expand Down
10 changes: 8 additions & 2 deletions packages/cdk/stacks/EpsAssistMeStack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {
App,
Stack,
StackProps,
CfnOutput
CfnOutput,
Fn
} from "aws-cdk-lib"
import {nagSuppressions} from "../nagSuppressions"
import {Apis} from "../resources/Apis"
Expand Down Expand Up @@ -30,6 +31,9 @@ export class EpsAssistMeStack extends Stack {
public constructor(scope: App, id: string, props: EpsAssistMeStackProps) {
super(scope, id, props)

// imports
const mainSlackBotLambdaExecutionRoleArn = Fn.importValue("epsam:lambda:SlackBot:ExecutionRole:Arn")

// Get variables from context
const region = Stack.of(this).region
const account = Stack.of(this).account
Expand Down Expand Up @@ -131,7 +135,9 @@ export class EpsAssistMeStack extends Stack {
slackBotTokenSecret: secrets.slackBotTokenSecret,
slackBotSigningSecret: secrets.slackBotSigningSecret,
slackBotStateTable: tables.slackBotStateTable.table,
promptName: bedrockPromptResources.queryReformulationPrompt.promptName
promptName: bedrockPromptResources.queryReformulationPrompt.promptName,
isPullRequest: isPullRequest,
mainSlackBotLambdaExecutionRoleArn: mainSlackBotLambdaExecutionRoleArn
})

// Create vector index after Functions are created
Expand Down