2022-09-10 13:07:46 +00:00
|
|
|
# reusable workflow
|
|
|
|
name: .dco
|
|
|
|
|
|
|
|
# TODO: hide reusable workflow from the UI. Tracked in https://github.com/community/community/discussions/12025
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
|
|
|
|
env:
|
|
|
|
ALPINE_VERSION: 3.16
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
run:
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2024-01-30 12:28:43 +00:00
|
|
|
uses: actions/checkout@v4
|
2022-09-10 13:07:46 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
-
|
|
|
|
name: Dump context
|
2024-01-30 12:31:56 +00:00
|
|
|
uses: actions/github-script@v7
|
2022-09-10 13:07:46 +00:00
|
|
|
with:
|
|
|
|
script: |
|
|
|
|
console.log(JSON.stringify(context, null, 2));
|
|
|
|
-
|
|
|
|
name: Get base ref
|
|
|
|
id: base-ref
|
2024-01-30 12:31:56 +00:00
|
|
|
uses: actions/github-script@v7
|
2022-09-10 13:07:46 +00:00
|
|
|
with:
|
|
|
|
result-encoding: string
|
|
|
|
script: |
|
|
|
|
if (/^refs\/pull\//.test(context.ref) && context.payload?.pull_request?.base?.ref != undefined) {
|
|
|
|
return context.payload.pull_request.base.ref;
|
|
|
|
}
|
|
|
|
return context.ref.replace(/^refs\/heads\//g, '');
|
2023-06-27 08:28:14 +00:00
|
|
|
-
|
|
|
|
name: Validate
|
|
|
|
run: |
|
|
|
|
docker run --rm \
|
|
|
|
-v "$(pwd):/workspace" \
|
|
|
|
-e VALIDATE_REPO \
|
|
|
|
-e VALIDATE_BRANCH \
|
|
|
|
alpine:${{ env.ALPINE_VERSION }} sh -c 'apk add --no-cache -q bash git openssh-client && git config --system --add safe.directory /workspace && cd /workspace && hack/validate/dco'
|
|
|
|
env:
|
|
|
|
VALIDATE_REPO: ${{ github.server_url }}/${{ github.repository }}.git
|
|
|
|
VALIDATE_BRANCH: ${{ steps.base-ref.outputs.result }}
|