From 664d2ee9be2c4e3ff7af205035f884508442e54c Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Fri, 29 Sep 2023 08:54:29 -0500 Subject: [PATCH 1/2] fix duplication of docs issues --- .github/workflows/docs-issue.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs-issue.yml b/.github/workflows/docs-issue.yml index b518b118d2e..5ec176cdd65 100644 --- a/.github/workflows/docs-issue.yml +++ b/.github/workflows/docs-issue.yml @@ -27,7 +27,13 @@ permissions: jobs: open_issues: - if: contains( github.event.pull_request.labels.*.name, 'user docs') && github.event.pull_request.merged == true + # we only want to run this when the PR has been merged or the label in the labeled event is `user docs`. Otherwise it runs the + # risk of duplicaton of issues being created due to merge and label both triggering this workflow to run and neither having + # generating the comment before the other runs. This lives here instead of the shared workflow because this is where we + # decide if it should run or not. + if: | + (contains( github.event.pull_request.labels.*.name, 'user docs') && github.event.pull_request.merged == true) || + (github.event.label.name == 'user docs' && github.event.action == 'labeled' ) uses: dbt-labs/actions/.github/workflows/open-issue-in-repo.yml@main with: issue_repository: "dbt-labs/docs.getdbt.com" From f3872b258422f00858c289ecb7ccfa7acf71b605 Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Fri, 29 Sep 2023 09:10:36 -0500 Subject: [PATCH 2/2] update conditional to only run on merged PRs --- .github/workflows/docs-issue.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs-issue.yml b/.github/workflows/docs-issue.yml index 5ec176cdd65..00a098df827 100644 --- a/.github/workflows/docs-issue.yml +++ b/.github/workflows/docs-issue.yml @@ -32,8 +32,9 @@ jobs: # generating the comment before the other runs. This lives here instead of the shared workflow because this is where we # decide if it should run or not. if: | - (contains( github.event.pull_request.labels.*.name, 'user docs') && github.event.pull_request.merged == true) || - (github.event.label.name == 'user docs' && github.event.action == 'labeled' ) + (github.event.pull_request.merged == true) && + ((github.event.action == 'closed' && contains( github.event.pull_request.labels.*.name, 'user docs')) || + (github.event.action == 'labeled' && github.event.label.name == 'user docs')) uses: dbt-labs/actions/.github/workflows/open-issue-in-repo.yml@main with: issue_repository: "dbt-labs/docs.getdbt.com"