From 589583c1dd3028ec4548f5d6be0bbf7b403fd1d3 Mon Sep 17 00:00:00 2001 From: Anil Vishnoi Date: Tue, 7 May 2024 11:42:53 -0700 Subject: [PATCH] Do not post bot welcome message on label change if the PR is closed Signed-off-by: Anil Vishnoi --- .github/workflows/lint-jobs.yml | 2 +- gobot/handlers/pull_request.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-jobs.yml b/.github/workflows/lint-jobs.yml index 11ba3eb9..046cb1cc 100644 --- a/.github/workflows/lint-jobs.yml +++ b/.github/workflows/lint-jobs.yml @@ -44,7 +44,7 @@ jobs: - name: Install required collections and roles run: ansible-galaxy install -r ./deploy/ansible/requirements.yml --force - name: Run ansible-lint - uses: ansible/ansible-lint@main + uses: ansible/ansible-lint@v6 with: working-directory: deploy shellcheck: diff --git a/gobot/handlers/pull_request.go b/gobot/handlers/pull_request.go index 28b54c4d..623e0987 100644 --- a/gobot/handlers/pull_request.go +++ b/gobot/handlers/pull_request.go @@ -36,10 +36,12 @@ func (h *PullRequestHandler) Handle(ctx context.Context, eventType, deliveryID s return nil } - if event.GetAction() != "labeled" { + if event.GetPullRequest().GetState() != "open" || event.GetAction() != "labeled" { return nil } + h.Logger.Debugf("Received pull request event: %v", event) + installID := githubapp.GetInstallationIDFromEvent(&event) repo := event.GetRepo() repoOwner := repo.GetOwner().GetLogin()