From 0544c7dae79c04965a36bb0f894badb3228c3efe Mon Sep 17 00:00:00 2001 From: Zoran Regvart Date: Fri, 26 Jul 2024 17:17:51 +0200 Subject: [PATCH] Attach a patch for needed updates to the TA Tasks When the workflow fails it should attach a patch that folk can apply to get the needed changes on their PR. Reference: https://issues.redhat.com/browse/EC-769 --- .github/workflows/check-ta.yaml | 6 ++++++ hack/generate-ta-tasks.sh | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-ta.yaml b/.github/workflows/check-ta.yaml index f42d2f9d1a..3a5e11eaa0 100644 --- a/.github/workflows/check-ta.yaml +++ b/.github/workflows/check-ta.yaml @@ -11,3 +11,9 @@ jobs: uses: actions/checkout@v4 - name: Check Trusted Artifact variants run: hack/generate-ta-tasks.sh + - name: Attach patch + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: Trusted artifacts patch + path: ./ta.patch diff --git a/hack/generate-ta-tasks.sh b/hack/generate-ta-tasks.sh index 502102a898..40fc6d2ecf 100755 --- a/hack/generate-ta-tasks.sh +++ b/hack/generate-ta-tasks.sh @@ -8,7 +8,8 @@ set -o posix shopt -s globstar nullglob HACK_DIR="$(realpath "$(dirname "${BASH_SOURCE[0]}")")" -TASK_DIR="$(realpath "${HACK_DIR}/../task")" +ROOT_DIR="$(git rev-parse --show-toplevel)" +TASK_DIR="$(realpath "${ROOT_DIR}/task")" if ! command -v tash &> /dev/null; then echo INFO: tash command is not available will download and use the latest version @@ -56,6 +57,9 @@ done if [[ ${changes} -gt 0 ]]; then if [ "${GITHUB_ACTIONS:-false}" == "true" ]; then + # shellcheck disable=SC2016 + echo '::notice title=Apply the attached patch::Download the attached `ta.patch` file and run `git apply ta.patch`' + git diff -u | tee "${ROOT_DIR}/ta.patch" exit 1 else printf "INFO: \033[1mMake sure to include the regenerated files in your changeset\033[0m\n"