summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorVijayakumar A <36878324+kumvijaya@users.noreply.github.com>2024-05-26 01:57:59 +0530
committerGitHub <noreply@github.com>2024-05-25 22:27:59 +0200
commit9301c507f91ea40fc0d4d86cf708a7ba6d3b0bb9 (patch)
treefae69af3ccd22e81a494c232034069263d3aab92 /scripts
parentb8d844027482ee3e2ec73e4b1c7881572e962f98 (diff)
downloadvyos-1x-9301c507f91ea40fc0d4d86cf708a7ba6d3b0bb9.tar.gz
vyos-1x-9301c507f91ea40fc0d4d86cf708a7ba6d3b0bb9.zip
T6399: added reusable workflows codeowners file to sagitta (#3515)
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/check-pr-title-and-commit-messages.py51
1 files changed, 0 insertions, 51 deletions
diff --git a/scripts/check-pr-title-and-commit-messages.py b/scripts/check-pr-title-and-commit-messages.py
deleted file mode 100755
index 001f6cf82..000000000
--- a/scripts/check-pr-title-and-commit-messages.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env python3
-
-import re
-import sys
-import time
-
-import requests
-
-# Use the same regex for PR title and commit messages for now
-title_regex = r'^(([a-zA-Z\-_.]+:\s)?)T\d+:\s+[^\s]+.*'
-commit_regex = title_regex
-
-def check_pr_title(title):
- if not re.match(title_regex, title):
- print("PR title '{}' does not match the required format!".format(title))
- print("Valid title example: T99999: make IPsec secure")
- sys.exit(1)
-
-def check_commit_message(title):
- if not re.match(commit_regex, title):
- print("Commit title '{}' does not match the required format!".format(title))
- print("Valid title example: T99999: make IPsec secure")
- sys.exit(1)
-
-if __name__ == '__main__':
- if len(sys.argv) < 2:
- print("Please specify pull request URL!")
- sys.exit(1)
-
- # There seems to be a race condition that causes this scripts to receive
- # an incomplete PR object that is missing certain fields,
- # which causes temporary CI failures that require re-running the script
- #
- # It's probably better to add a small delay to prevent that
- time.sleep(5)
-
- # Get the pull request object
- pr = requests.get(sys.argv[1]).json()
- if "title" not in pr:
- print("The PR object does not have a title field!")
- print("Did not receive a valid pull request object, please check the URL!")
- sys.exit(1)
-
- check_pr_title(pr["title"])
-
- # Get the list of commits
- commits = requests.get(pr["commits_url"]).json()
- for c in commits:
- # Retrieve every individual commit and check its title
- co = requests.get(c["url"]).json()
- check_commit_message(co["commit"]["message"])