From d82a1fad205ed11a2403af27757b13f7cfaef0f1 Mon Sep 17 00:00:00 2001 From: Michael Molisani Date: Mon, 4 Nov 2024 09:36:29 -0500 Subject: [PATCH] ci: use event sender as DCO signoff Signed-off-by: Michael Molisani --- .github/workflows/release.yml | 3 +++ scripts/dco_commit_msg_hook.sh | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 scripts/dco_commit_msg_hook.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6243fc2..6101cab 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,9 +33,12 @@ jobs: - run: git config --global user.name "github-actions[bot]" - run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + - run: cp scripts/dco_commit_msg_hook.sh .git/hooks/prepare-commit-msg - run: npx nx release --yes ${{ inputs.dry-run && '--dry-run' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_CONFIG_PROVENANCE: true + DCO_NAME: ${{ sender.name }} + DCO_EMAIL: ${{ sender.email }} diff --git a/scripts/dco_commit_msg_hook.sh b/scripts/dco_commit_msg_hook.sh new file mode 100644 index 0000000..e688284 --- /dev/null +++ b/scripts/dco_commit_msg_hook.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +git interpret-trailers --if-exists doNothing --trailer \ + "Signed-off-by: $DCO_NAME <$DCO_EMAIL>" \ + --in-place "$1"