| 
1 | 1 | # **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  | 
3 | 3 | 
 
  | 
4 | 4 | # **why?**  | 
5 | 5 | # To reduce barriers for keeping docs up to date  | 
6 | 6 | 
 
  | 
7 | 7 | # **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.  | 
10 | 9 | 
 
  | 
11 | 10 | 
 
  | 
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 }}"  | 
14 | 13 | 
 
  | 
15 | 14 | on:  | 
16 |  | -  pull_request_target:  | 
 | 15 | +  issues:  | 
17 | 16 |     types: [labeled, closed]  | 
18 | 17 | 
 
  | 
19 | 18 | defaults:  | 
20 | 19 |   run:  | 
21 | 20 |     shell: bash  | 
22 | 21 | 
 
  | 
23 | 22 | permissions:  | 
24 |  | -    issues: write # opens new issues  | 
25 |  | -    pull-requests: write # comments on PRs  | 
26 |  | - | 
 | 23 | +    issues: write # comments on issues  | 
27 | 24 | 
 
  | 
28 | 25 | jobs:  | 
29 | 26 |   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  | 
31 | 29 |     # risk of duplicaton of issues being created due to merge and label both triggering this workflow to run and neither having  | 
32 | 30 |     # generating the comment before the other runs.  This lives here instead of the shared workflow because this is where we  | 
33 | 31 |     # decide if it should run or not.  | 
34 | 32 |     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')) ||  | 
37 | 35 |       (github.event.action == 'labeled' && github.event.label.name == 'user docs'))  | 
38 | 36 |     uses: dbt-labs/actions/.github/workflows/open-issue-in-repo.yml@main  | 
39 | 37 |     with:  | 
40 | 38 |         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 }}"  | 
42 | 40 |         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."  | 
43 | 41 |     secrets: inherit  | 
0 commit comments