Skip to content

Commit

Permalink
Attach a patch for needed updates to the TA Tasks
Browse files Browse the repository at this point in the history
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
  • Loading branch information
zregvart committed Jul 31, 2024
1 parent c22e710 commit a2c2045
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/workflows/check-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@ jobs:
- name: Check out code
uses: actions/checkout@v4
- name: Check Trusted Artifact variants
id: check
run: hack/generate-ta-tasks.sh
- name: Attach patch
if: ${{ always() && steps.check.conclusion == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: Trusted artifacts patch
path: ./ta.patch
6 changes: 5 additions & 1 deletion hack/generate-ta-tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit a2c2045

Please sign in to comment.