diff --git a/.github/actions/add-codeowners/codeowners.sh b/.github/actions/add-codeowners/codeowners.sh new file mode 100755 index 0000000000..f22633f8c4 --- /dev/null +++ b/.github/actions/add-codeowners/codeowners.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +for file in "$@"; do + temp_file="tempfile.xml" + + # force write a new line at the end of the gotestsum-report.xml, or else + # the loop will skip the last line. + # fixes issue with a missing + echo -e "\n" >> $file + + while read p; do + # we might try to report gotestsum-report.xml multiple times, so don't + # calculate codeowners more times than we need + if [[ "$p" =~ \| file=\"$file_name\">|") + echo "$new_line" >> "$temp_file" + else + echo "$p" >> "$temp_file" + fi + done < $file + + mv "$temp_file" $file +done \ No newline at end of file diff --git a/.github/actions/dd-ci-upload/action.yml b/.github/actions/dd-ci-upload/action.yml index 3318728c50..c9da152c47 100644 --- a/.github/actions/dd-ci-upload/action.yml +++ b/.github/actions/dd-ci-upload/action.yml @@ -42,6 +42,10 @@ runs: curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_${{ env.DD_CI_CLI_BUILD }}" --output datadog-ci chmod +x datadog-ci + - name: Add CodeOwners to JUnit files + shell: bash + run: cd ./.github/actions/add-codeowners && ./codeowners.sh ${{ inputs.files }} + - name: Upload the JUnit files shell: bash run: |