|
| 1 | +name: 'Validate skip QA label' |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, reopened, labeled, unlabeled] |
| 6 | + branches: |
| 7 | + - master |
| 8 | + |
| 9 | +jobs: |
| 10 | + validate-skip-qa: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + permissions: |
| 14 | + pull-requests: write |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout Code |
| 18 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 19 | + |
| 20 | + - name: Get files changed |
| 21 | + id: changed_files |
| 22 | + uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5 |
| 23 | + with: |
| 24 | + files: | |
| 25 | + **/datadog_checks/** |
| 26 | + **/changelog.d/** |
| 27 | + **/pyproject.toml |
| 28 | + **/hatch.toml |
| 29 | + files_ignore: | |
| 30 | + ddev/** |
| 31 | + datadog_checks_dev/** |
| 32 | + datadog_checks_tests_helper/** |
| 33 | +
|
| 34 | + - name: Post message - Add skip qa label |
| 35 | + if: steps.changed_files.outputs.any_changed == 'false' && !contains(github.event.pull_request.labels.*.name, 'qa/skip-qa') |
| 36 | + uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 |
| 37 | + with: |
| 38 | + issue-number: ${{ github.event.pull_request.number }} |
| 39 | + body: | |
| 40 | + ⚠️ **Recommendation: Add `qa/skip-qa` Label** |
| 41 | +
|
| 42 | + This PR does not modify any files shipped with the agent. |
| 43 | +
|
| 44 | + To help streamline the release process, please consider adding the `qa/skip-qa` label if these changes do not require QA testing. |
| 45 | +
|
| 46 | + - name: Format file list for comment |
| 47 | + id: format_files |
| 48 | + if: steps.changed_files.outputs.any_changed == 'true' |
| 49 | + run: | |
| 50 | + formatted_list=$(echo "${{ steps.changed_files.outputs.all_changed_files }}" | tr ' ' '\n') |
| 51 | + echo "file_list<<EOF" >> $GITHUB_OUTPUT |
| 52 | + echo "$formatted_list" >> $GITHUB_OUTPUT |
| 53 | + echo "EOF" >> $GITHUB_OUTPUT |
| 54 | +
|
| 55 | + - name: Post comment - Remove skip qa label |
| 56 | + 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** |
| 62 | +
|
| 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. |
| 65 | +
|
| 66 | + You can ignore this if you are sure the changes in this PR do not require QA. Otherwise, consider removing the label. |
| 67 | +
|
| 68 | + <details> |
| 69 | + <summary>List of modified files that will be shipped with the agent</summary> |
| 70 | +
|
| 71 | + ``` |
| 72 | + ${{ steps.format_files.outputs.file_list }} |
| 73 | + ``` |
| 74 | +
|
| 75 | + </details> |
0 commit comments