From 414fa281cc0694f855c15e13e969d89a0c79b8d0 Mon Sep 17 00:00:00 2001 From: bin liu Date: Wed, 23 Sep 2020 15:58:38 +0800 Subject: [PATCH] add basic github workflow for basic checks Basic checks includes: - Must have commit title/body - Must have DCO(SoC) - Title/Body line length are limited 75/72 - Add wip/do-not-merge to label PRs that could be merged Fixes: #15 Signed-off-by: bin liu --- .github/workflows/PR-wip-checks.yaml | 21 ++++++++ .github/workflows/commit-message-check.yaml | 53 +++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 .github/workflows/PR-wip-checks.yaml create mode 100644 .github/workflows/commit-message-check.yaml diff --git a/.github/workflows/PR-wip-checks.yaml b/.github/workflows/PR-wip-checks.yaml new file mode 100644 index 0000000..16f8167 --- /dev/null +++ b/.github/workflows/PR-wip-checks.yaml @@ -0,0 +1,21 @@ +name: Pull request WIP checks +on: + pull_request: + types: + - opened + - synchronize + - reopened + - edited + - labeled + - unlabeled + +jobs: + pr_wip_check: + runs-on: ubuntu-latest + name: WIP Check + steps: + - name: WIP Check + uses: tim-actions/wip-check@1c2a1ca6c110026b3e2297bb2ef39e1747b5a755 + with: + labels: '["do-not-merge", "wip", "rfc"]' + keywords: '["WIP", "wip", "RFC", "rfc", "dnm", "DNM", "do-not-merge"]' diff --git a/.github/workflows/commit-message-check.yaml b/.github/workflows/commit-message-check.yaml new file mode 100644 index 0000000..4d1c57e --- /dev/null +++ b/.github/workflows/commit-message-check.yaml @@ -0,0 +1,53 @@ +name: Commit Message Check +on: + pull_request: + types: + - opened + - reopened + - synchronize + +env: + error_msg: |+ + See the document below for help on formatting commits for the project. + + https://github.com/kata-containers/community/blob/master/CONTRIBUTING.md#patch-forma + +jobs: + commit-message-check: + runs-on: ubuntu-latest + name: Commit Message Check + steps: + - name: Get PR Commits + id: 'get-pr-commits' + uses: tim-actions/get-pr-commits@v1.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: DCO Check + uses: tim-actions/dco@2fd0504dc0d27b33f542867c300c60840c6dcb20 + with: + commits: ${{ steps.get-pr-commits.outputs.commits }} + + - name: Commit Body Missing Check + if: ${{ success() || failure() }} + uses: tim-actions/commit-body-check@v1.0.2 + with: + commits: ${{ steps.get-pr-commits.outputs.commits }} + + - name: Check Subject Line Length + if: ${{ success() || failure() }} + uses: tim-actions/commit-message-checker-with-regex@v0.3.1 + with: + commits: ${{ steps.get-pr-commits.outputs.commits }} + pattern: '^.{0,75}(\n.*)*$' + error: 'Subject too long (max 75)' + post_error: ${{ env.error_msg }} + + - name: Check Body Line Length + if: ${{ success() || failure() }} + uses: tim-actions/commit-message-checker-with-regex@v0.3.1 + with: + commits: ${{ steps.get-pr-commits.outputs.commits }} + pattern: '^.+(\n.{0,72})*$|^.+\n\s*[^a-zA-Z\s\n]|^.+\n\S+$' + error: 'Body line too long (max 72)' + post_error: ${{ env.error_msg }}