Skip to content
Merged

Cicd #33

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/card-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ jobs:
repo: context.repo.repo,
issue_number: context.issue.number,
body: "**Validation Failed!** \n\n" +
"The branch name and PR title must follow the `TADocs-` pattern.\n" +
"- Ensure the branch name starts with `TADocs-`.\n" +
"- Ensure the PR title contains `TADocs-`.\n\n" +

"The branch name and PR title must follow the `ATOM-PJT-` pattern.\n" +
"- Ensure the branch name starts with `ATOM-PJT-`.\n" +
"- Ensure the PR title contains `ATOM-PJT-`.\n\n" +
"Please adjust and try again. Thank you!"
});
console.log(`Comment added: ${comment.html_url}`);
Expand Down
19 changes: 10 additions & 9 deletions scripts/validate_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@

def validate_branch_and_pr_title(branch, pr_title):
"""
Validates if the branch name and PR title follow the 'TADocs-' pattern.
Validates if the branch name and PR title follow the 'ATOM-PJT-' pattern.
Args:
branch (str): The name of the branch to validate.
pr_title (str): The title of the pull request (PR) to validate.
Returns:
bool: True if both the branch and the pull request follow the 'TADocs-' pattern, False otherwise.
bool: True if both the branch and the pull request follow the 'ATOM-PJT-' pattern, False otherwise.
Prints:
str: A message indicating whether the branch and PR title are valid or specifying the validation error.
"""

# Verify if the branch starts with 'TADocs-'
if not branch.startswith("TADocs-"):
print(f"The branch '{branch}' does not start with the pattern 'TADocs-'.")

# Verify if the branch starts with 'ATOM-PJT-'
if not branch.startswith("ATOM-PJT-"):
print(f"The branch '{branch}' does not start with the pattern 'ATOM-PJT-'.")
return False
# Verify if the branch contains with 'TADocs-'
if "TADocs-" not in pr_title:
print(f"The PR title '{pr_title}' does not contain the pattern 'TADocs-'.")
# Verify if the branch contains with 'ATOM-PJT-'
if "ATOM-PJT-" not in pr_title:
print(f"The PR title '{pr_title}' does not contain the pattern 'ATOM-PJT-'.")
return False

print(f"Validation successful: The branch '{branch}' and the PR title '{pr_title}' follow the 'TADocs-' pattern.")
print(f"Validation successful: The branch '{branch}' and the PR title '{pr_title}' follow the 'ATOM-PJT-' pattern.")

return True

Expand Down
Loading