Skip to content

Commit

Permalink
Validating PR Issue Checker Workflow (#697)
Browse files Browse the repository at this point in the history
## Description
 Closes #671 

This workflow ensures that every pull request description includes an
associated issue number for better tracking and clarity. If the required
format is not met, contributors will receive clear feedback on how to
correct it.

## Error Case
**When the PR description does not meet the required format (missing the
issue reference):**

- **PR description:** Fixed bug
- **Output:**
The PR description should include the issue number assigned to you. ⚠️
##[error]An issue reference like 'Fixed #<issue-number>' must be
included in the description.

## Success
- **PR description**: Fixed # or Issue number # or Closes #
- **Output:**
PR description is valid.
All checks passed.





## Checklist
<!-- [X] - put a cross/X inside [] to check the box -->
- [x] I have gone through the [contributing
guide](https://github.com/Anjaliavv51/Retro)
- [x] I have updated my branch and synced it with project `main` branch
before making this PR
- [x] I have performed a self-review of my code
- [x] I have tested the changes thoroughly before submitting this pull
request.
- [x] I have provided relevant issue numbers, screenshots, and videos
after making the changes.
- [x] I have commented my code, particularly in hard-to-understand
areas.


## Additional context:
@Anjaliavv51  please add all the necessary labels
  • Loading branch information
Anjaliavv51 authored Jan 13, 2025
2 parents 6c3416e + f0d390c commit 44b251a
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/pr-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: PR Issue Checker

on:
pull_request:
types: [opened, edited]

jobs:
check_pr_description:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Check PR Description
id: check_pr_description
run: |
PR_DESCRIPTION="${{ github.event.pull_request.body }}"
if [[ -z "$PR_DESCRIPTION" ]]; then
echo "PR description is missing."
exit 1
fi
# Allow any text before #<issue-number>
if [[ ! "$PR_DESCRIPTION" =~ .*\ #[0-9]+ ]]; then
echo "The PR description should include the issue number assigned to you.⚠️"
echo "##[error]An issue reference like 'Fixed #<issue-number>' must be included in the description."
exit 1
fi
echo "PR description is valid."
- name: Output result
run: echo "All checks passed."

0 comments on commit 44b251a

Please sign in to comment.