@@ -2,10 +2,18 @@ name: 'Validate skip QA label'
22
33on :
44 pull_request :
5- types : [opened, synchronize, reopened, labeled, unlabeled ]
5+ types : [opened, synchronize]
66 branches :
77 - master
88
9+ env :
10+ COMMENT_BODY_ADD_LABEL : |
11+ ⚠️ **Recommendation: Add `qa/skip-qa` Label**
12+
13+ This PR does not modify any files shipped with the agent.
14+
15+ To help streamline the release process, please consider adding the `qa/skip-qa` label if these changes do not require QA testing.
16+
917jobs :
1018 validate-skip-qa :
1119 runs-on : ubuntu-latest
3139 datadog_checks_dev/**
3240 datadog_checks_tests_helper/**
3341
34- - name : Post message - Add skip qa label
42+ - name : Find comment - Add skip qa label
3543 if : steps.changed_files.outputs.any_changed == 'false' && !contains(github.event.pull_request.labels.*.name, 'qa/skip-qa')
44+ uses : peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
45+ id : find_comment_add_label
46+ with :
47+ issue-number : ${{ github.event.pull_request.number }}
48+ body-includes : ${{ env.COMMENT_BODY_ADD_LABEL }}
49+
50+ - name : Post message - Add skip qa label
51+ if : steps.changed_files.outputs.any_changed == 'false' && !contains(github.event.pull_request.labels.*.name, 'qa/skip-qa') && steps.find_comment_add_label.outputs.comment-id == ''
3652 uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
3753 with :
3854 issue-number : ${{ github.event.pull_request.number }}
@@ -52,24 +68,43 @@ jobs:
5268 echo "$formatted_list" >> $GITHUB_OUTPUT
5369 echo "EOF" >> $GITHUB_OUTPUT
5470
55- - name : Post comment - Remove skip qa label
71+ - name : Construct "Remove skip qa label" comment body
72+ id : construct_remove_label_comment
5673 if : steps.changed_files.outputs.any_changed == 'true' && contains(github.event.pull_request.labels.*.name, 'qa/skip-qa')
57- uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
58- with :
59- issue-number : ${{ github.event.pull_request.number }}
60- body : |
61- ⚠️ **The `qa/skip-qa` label has been added with shippable changes**
74+ run : |
75+ comment_body=$(cat <<EOF
76+ ⚠️ **The \`qa/skip-qa\` label has been added with shippable changes**
77+
78+ The following files, which will be shipped with the agent, were modified in this PR and
79+ the \`qa/skip-qa\` label has been added.
6280
63- The following files, which will be shipped with the agent, were modified in this PR and
64- the `qa/skip-qa` label has been added.
81+ You can ignore this if you are sure the changes in this PR do not require QA. Otherwise, consider removing the label.
6582
66- You can ignore this if you are sure the changes in this PR do not require QA. Otherwise, consider removing the label.
83+ <details>
84+ <summary>List of modified files that will be shipped with the agent</summary>
6785
68- <details>
69- <summary>List of modified files that will be shipped with the agent</summary>
86+ \`\`\`
87+ ${{ steps.format_files.outputs.file_list }}
88+ \`\`\`
7089
71- ```
72- ${{ steps.format_files.outputs.file_list }}
73- ```
90+ </details>
91+ EOF
92+ )
93+ echo "body<<EOF" >> $GITHUB_OUTPUT
94+ echo "$comment_body" >> $GITHUB_OUTPUT
95+ echo "EOF" >> $GITHUB_OUTPUT
7496
75- </details>
97+ - name : Find comment - Remove skip qa label
98+ if : steps.changed_files.outputs.any_changed == 'true' && contains(github.event.pull_request.labels.*.name, 'qa/skip-qa')
99+ uses : peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
100+ id : find_comment_remove_label
101+ with :
102+ issue-number : ${{ github.event.pull_request.number }}
103+ body-includes : ${{ steps.construct_remove_label_comment.outputs.body }}
104+
105+ - name : Post comment - Remove skip qa label
106+ if : steps.changed_files.outputs.any_changed == 'true' && contains(github.event.pull_request.labels.*.name, 'qa/skip-qa') && steps.find_comment_remove_label.outputs.comment-id == ''
107+ uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
108+ with :
109+ issue-number : ${{ github.event.pull_request.number }}
110+ body : ${{ steps.construct_remove_label_comment.outputs.body }}
0 commit comments