Release v0.38.0 #148
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR Title Jira Ticket Check | |
on: | |
pull_request: | |
types: | |
- opened | |
- edited | |
- reopened | |
- synchronize | |
jobs: | |
check-pr-title: | |
name: Validate PR Title | |
runs-on: ubuntu-latest | |
outputs: | |
jira-check-passed: ${{ steps.jira-check.outcome == 'success' }} | |
release-check-passed: ${{ steps.release-check.outcome == 'success' }} | |
steps: | |
# Step 1: Check out the code | |
- name: Check out code | |
uses: actions/checkout@v4 | |
# Step 2: Check for Jira Ticket in PR Title | |
- name: Check for Jira Ticket in PR Title | |
id: jira-check | |
continue-on-error: true | |
run: | | |
PR_TITLE=$(jq -r .pull_request.title "$GITHUB_EVENT_PATH") | |
JIRA_TICKET_REGEX="(CMP|IN)-[0-9]+" | |
if ! [[ $PR_TITLE =~ $JIRA_TICKET_REGEX ]]; then | |
echo "PR title does not contain a valid JIRA ticket format (CMP-xxxx) or (IN-xxxx)." | |
exit 1 | |
fi | |
env: | |
GITHUB_EVENT_PATH: ${{ github.event_path }} | |
# Step 3: Check for Release Prefix in PR Title | |
- name: Check for Release Prefix in PR Title | |
id: release-check | |
continue-on-error: true | |
run: | | |
PR_TITLE=$(jq -r .pull_request.title "$GITHUB_EVENT_PATH") | |
RELEASE_PREFIX_REGEX="^Release" | |
if ! [[ $PR_TITLE =~ $RELEASE_PREFIX_REGEX ]]; then | |
echo "PR title does not start with 'Release'." | |
exit 1 | |
fi | |
env: | |
GITHUB_EVENT_PATH: ${{ github.event_path }} | |
# Step 4: Final Check | |
- name: Determine Success of Workflow | |
if: steps.jira-check.outcome == 'failure' && steps.release-check.outcome == 'failure' | |
run: | | |
echo "## :error: Invalid PR Title Format" >> $GITHUB_STEP_SUMMARY | |
echo "The PR title must start with a JIRA ticket (e.g., 'CMP-xxxx') or 'Release'." | |
echo "Please update the PR title to conform to the required format." >> $GITHUB_STEP_SUMMARY | |
exit 1 |