Skip to content

[pull] master from DataDog:master #363

[pull] master from DataDog:master

[pull] master from DataDog:master #363

name: 'Validate skip QA label'
on:
pull_request_target:
types: [opened, synchronize]
branches:
- master
jobs:
validate-skip-qa:
if: '!github.event.pull_request.draft'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Get files changed
id: changed_files
uses: tj-actions/changed-files@7dee1b0c1557f278e5c7dc244927139d78c0e22a # v47.0.4
with:
files: |
**/datadog_checks/**
**/changelog.d/**
**/pyproject.toml
**/hatch.toml
files_ignore: |
ddev/**
datadog_checks_dev/**
datadog_checks_tests_helper/**
- name: Find comment
uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4.0.0
id: find_comment
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: "`qa/skip-qa` label"
comment-author: "github-actions[bot]"
- name: Post message - Add skip qa label
if: steps.changed_files.outputs.any_changed == 'false' && !contains(github.event.pull_request.labels.*.name, 'qa/skip-qa')
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
⚠️ **Recommendation: Add `qa/skip-qa` label**
This PR does not modify any files shipped with the agent.
To help streamline the release process, please consider adding the `qa/skip-qa` label if these changes do not require QA testing.
comment-id: ${{ steps.find_comment.outputs.comment-id }}
edit-mode: "replace"
- name: Format file list for comment
id: format_files
if: steps.changed_files.outputs.any_changed == 'true' && contains(github.event.pull_request.labels.*.name, 'qa/skip-qa')
run: |
formatted_list=$(echo "${{ steps.changed_files.outputs.all_changed_files }}" | tr ' ' '\n')
echo "file_list<<EOF" >> $GITHUB_OUTPUT
echo "$formatted_list" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Construct "Remove skip qa label" comment body
id: construct_remove_label_comment
if: steps.changed_files.outputs.any_changed == 'true' && contains(github.event.pull_request.labels.*.name, 'qa/skip-qa')
run: |
comment_body=$(cat <<EOF
⚠️ **The \`qa/skip-qa\` label has been added with shippable changes**
The following files, which will be shipped with the agent, were modified in this PR and
the \`qa/skip-qa\` label has been added.
You can ignore this if you are sure the changes in this PR do not require QA. Otherwise, consider removing the label.
<details>
<summary>List of modified files that will be shipped with the agent</summary>
\`\`\`
${{ steps.format_files.outputs.file_list }}
\`\`\`
</details>
EOF
)
echo "body<<EOF" >> $GITHUB_OUTPUT
echo "$comment_body" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Post comment - Remove skip qa label
if: steps.changed_files.outputs.any_changed == 'true' && contains(github.event.pull_request.labels.*.name, 'qa/skip-qa')
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.construct_remove_label_comment.outputs.body }}
comment-id: ${{ steps.find_comment.outputs.comment-id }}
edit-mode: "replace"