From 6bddbee7a5cb5c61108f7c5fd8e77dbd3b9e0e12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Wed, 21 Jun 2023 21:43:46 -0400 Subject: [PATCH] github: Add DCO/target tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- .github/workflows/commits.yml | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/commits.yml diff --git a/.github/workflows/commits.yml b/.github/workflows/commits.yml new file mode 100644 index 0000000..57f5d69 --- /dev/null +++ b/.github/workflows/commits.yml @@ -0,0 +1,40 @@ +name: Commits +on: + - pull_request + +permissions: + contents: read + +jobs: + dco-check: + permissions: + pull-requests: read # for tim-actions/get-pr-commits to get list of commits from the PR + name: Signed-off-by (DCO) + runs-on: ubuntu-20.04 + steps: + - name: Get PR Commits + id: 'get-pr-commits' + uses: tim-actions/get-pr-commits@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Check that all commits are signed-off + uses: tim-actions/dco@master + with: + commits: ${{ steps.get-pr-commits.outputs.commits }} + + target-branch: + permissions: + contents: none + name: Branch target + runs-on: ubuntu-20.04 + steps: + - name: Check branch target + env: + TARGET: ${{ github.event.pull_request.base.ref }} + run: | + set -x + [ "${TARGET}" = "master" ] && exit 0 + + echo "Invalid branch target: ${TARGET}" + exit 1