public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/rust/master] ci: Add commit format checker
Date: Wed,  1 Feb 2023 09:24:16 +0000 (GMT)	[thread overview]
Message-ID: <20230201092416.53C333858002@sourceware.org> (raw)

https://gcc.gnu.org/g:c146eb7d99b5074bf7bb66d1a7076e138c92a808

commit c146eb7d99b5074bf7bb66d1a7076e138c92a808
Author: Arthur Cohen <arthur.cohen@embecosm.com>
Date:   Tue Jan 31 15:38:02 2023 +0100

    ci: Add commit format checker

Diff:
---
 .github/workflows/commit-format.yml | 93 +++++++++++++++++++++++++++++++++++++
 1 file changed, 93 insertions(+)

diff --git a/.github/workflows/commit-format.yml b/.github/workflows/commit-format.yml
new file mode 100644
index 00000000000..66d0e19bf75
--- /dev/null
+++ b/.github/workflows/commit-format.yml
@@ -0,0 +1,93 @@
+name: GNU Commit Format Checker
+
+on:
+  pull_request:
+    branches:
+      - master
+      - gcc-patch-dev
+
+jobs:
+  check_commit_changelogs:
+    runs-on: ubuntu-latest
+    name: check-changelogs
+    
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          ref: ${{ github.event.pull_request.head.sha }}
+          fetch-depth: 0
+
+      - name: Install Deps
+        run: |
+          sudo apt-get update;
+          sudo apt-get install -y \
+            python3 \
+            python3-git
+      
+      - name: GCC check PR Commits
+        run: |
+          python3 contrib/gcc-changelog/git_check_commit.py origin/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.sha }}
+
+  check_commit_prefixes:
+    runs-on: ubuntu-latest
+    name: check-gccrs-prefix
+    
+    steps:
+      - uses: actions/checkout@v3
+        if: ${{ github.base_ref == 'gcc-patch-dev' }} # master commits don't need the gccrs prefix
+        with:
+          ref: ${{ github.event.pull_request.head.sha }}
+          fetch-depth: 0
+
+      - name: Check for `gccrs` prefix
+        run: |
+          retval=0
+          for commit in $(git rev-list origin/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.sha }});
+          do
+            echo -n "Checking gccrs prefix for $commit: " >> results
+            if [[ $(git log -1 --format="%s" $commit) = gccrs:* ]]; then
+              echo "OK" >> results
+            else
+              retval=1
+              echo "KO" >> results
+            fi
+          done
+          exit $retval
+
+  check_commit_signoff:
+    runs-on: ubuntu-latest
+    name: check-commit-signoff
+    
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          ref: ${{ github.event.pull_request.head.sha }}
+          fetch-depth: 0
+
+      - name: Check for DCO Sign-Off line/possible FSF Copyright Assignment
+        run: |
+          retval=0;
+          rev_list="origin/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.sha }}"
+
+          for commit in $(git rev-list --reverse "$rev_list"); do
+            echo -n "Checking for DCO Sign-Off for commit $commit... ";
+
+            if [[ $(git log "$commit" -1 --format="%B" | tail -n 2) = Signed-off-by:* ]]; then
+              echo "OK";
+              continue;
+            fi
+
+            author=$(git log -1 --format=%an "$commit");
+
+            if [[ "$(( $(git log --author="$author"|wc -l) - $(git log --author="$author" --grep='Signed-off-by'|wc -l )))" -ne 0 ]]; then
+              echo "OK"
+              echo "$author probably has FSF Copyright Assignment. Check manually that the lack of DCO Sign-Off is allowed."
+            else
+              echo "KO"
+              retval=1;
+            fi
+          done;
+
+          exit $retval;
+
+

                 reply	other threads:[~2023-02-01  9:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230201092416.53C333858002@sourceware.org \
    --to=tschwinge@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).