Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit b828c30

Browse files
authored
update user docs-issue workflow (#1260)
* update user docs-issue workflow * add or condition trigger for workflow * update workflow based onf feedback * update workflow based onf feedback * readd line 35 from previous commit
1 parent e678489 commit b828c30

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

.github/workflows/docs-issue.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,41 @@
11
# **what?**
2-
# Open an issue in docs.getdbt.com when a PR is labeled `user docs`
2+
# Open an issue in docs.getdbt.com when an issue is labeled `user docs` and closed as completed
33

44
# **why?**
55
# To reduce barriers for keeping docs up to date
66

77
# **when?**
8-
# When a PR is labeled `user docs` and is merged. Runs on pull_request_target to run off the workflow already merged,
9-
# not the workflow that existed on the PR branch. This allows old PRs to get comments.
8+
# When an issue is labeled `user docs` and is closed as completed. Can be labeled before or after the issue is closed.
109

1110

12-
name: Open issues in docs.getdbt.com repo when a PR is labeled
13-
run-name: "Open an issue in docs.getdbt.com for PR #${{ github.event.pull_request.number }}"
11+
name: Open issues in docs.getdbt.com repo when an issue is labeled
12+
run-name: "Open an issue in docs.getdbt.com for issue #${{ github.event.issue.number }}"
1413

1514
on:
16-
pull_request_target:
15+
issues:
1716
types: [labeled, closed]
1817

1918
defaults:
2019
run:
2120
shell: bash
2221

2322
permissions:
24-
issues: write # opens new issues
25-
pull-requests: write # comments on PRs
26-
23+
issues: write # comments on issues
2724

2825
jobs:
2926
open_issues:
30-
# 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
27+
# we only want to run this when the issue is closed as completed and the label `user docs` has been assigned.
28+
# If this logic does not exist in this workflow, it runs the
3129
# risk of duplicaton of issues being created due to merge and label both triggering this workflow to run and neither having
3230
# generating the comment before the other runs. This lives here instead of the shared workflow because this is where we
3331
# decide if it should run or not.
3432
if: |
35-
(github.event.pull_request.merged == true) &&
36-
((github.event.action == 'closed' && contains( github.event.pull_request.labels.*.name, 'user docs')) ||
33+
(github.event.issue.state == 'closed' && github.event.issue.state_reason == 'completed') && (
34+
(github.event.action == 'closed' && contains(github.event.issue.labels.*.name, 'user docs')) ||
3735
(github.event.action == 'labeled' && github.event.label.name == 'user docs'))
3836
uses: dbt-labs/actions/.github/workflows/open-issue-in-repo.yml@main
3937
with:
4038
issue_repository: "dbt-labs/docs.getdbt.com"
41-
issue_title: "Docs Changes Needed from ${{ github.event.repository.name }} PR #${{ github.event.pull_request.number }}"
39+
issue_title: "Docs Changes Needed from ${{ github.event.repository.name }} Issue #${{ github.event.issue.number }}"
4240
issue_body: "At a minimum, update body to include a link to the page on docs.getdbt.com requiring updates and what part(s) of the page you would like to see updated."
4341
secrets: inherit

0 commit comments

Comments
 (0)