From c1e27792d4c584ad0084b236144fa54d9658c93d Mon Sep 17 00:00:00 2001 From: Benjamin Borbe Date: Sat, 14 Nov 2026 16:01:00 +0100 Subject: [PATCH] feat: require a Task identifier line in the PR body --- .github/workflows/check-task-link.yml | 26 ++++++++++++++++++++++++++ .github/workflows/ci.yml | 12 ++++++------ CHANGELOG.md | 4 ++++ 3 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/check-task-link.yml diff --git a/.github/workflows/check-task-link.yml b/.github/workflows/check-task-link.yml new file mode 100644 index 0000000..ba80e1a --- /dev/null +++ b/.github/workflows/check-task-link.yml @@ -0,0 +1,26 @@ +name: check-task-link +on: + pull_request: + types: [opened, reopened, edited, synchronize, ready_for_review] + +permissions: + contents: read + +jobs: + task-link: + runs-on: ubuntu-latest + steps: + - name: "Require a Task: line in the PR body" + env: + PR_BODY: ${{ github.event.pull_request.body }} + run: | + # Anchored at the start of a line and case-sensitive on the key, so + # `subtask: ` and `not a task: ` cannot satisfy the gate. + # The UUID must also be the whole remainder of the line. + if printf '%s\n' "$PR_BODY" \ + | grep -Eq '^[[:space:]]*Task:[[:space:]]*[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}[[:space:]]*$'; then + echo "PR body names a task identifier" + exit 0 + fi + echo "::error::PR body has no 'Task: ' line. Add the vault task UUID on a line of its own." + exit 1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99e1818..bd61f03 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,13 +25,13 @@ jobs: cache-dependency-path: go.sum - name: Install Trivy + env: + TRIVY_VERSION: v0.76.2 + TRIVY_SHA256: bc0fc726e017b8927a62b2d3531d7a84ee01769daf5c99ed866dced54089fdbf run: | - sudo apt-get update - sudo apt-get install -y wget apt-transport-https gnupg lsb-release - wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add - - echo "deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee -a /etc/apt/sources.list.d/trivy.list - sudo apt-get update - sudo apt-get install -y trivy + curl -sfL "https://github.com/aquasecurity/trivy/releases/download/${TRIVY_VERSION}/trivy_${TRIVY_VERSION#v}_Linux-64bit.tar.gz" -o /tmp/trivy.tar.gz + echo "${TRIVY_SHA256} /tmp/trivy.tar.gz" | sha256sum -c - + sudo tar -xzf /tmp/trivy.tar.gz -C /usr/local/bin trivy - name: Run precommit checks env: diff --git a/CHANGELOG.md b/CHANGELOG.md index c6f9a69..1c5a748 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ Please choose versions by [Semantic Versioning](http://semver.org/). * MINOR version when you add functionality in a backwards-compatible manner, and * PATCH version when you make backwards-compatible bug fixes. +## Unreleased + +- feat: add a `check-task-link` gate that fails a PR whose body carries no `Task: ` line, and install a pinned, checksum-verified Trivy release so `test` stops failing on the retired keyring helper + ## v0.51.3 - chore: update Go to 1.27.4