-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
this check for screenshot in a pr request which is kinda mandatory for better readibilty
- Loading branch information
1 parent
eaaefb0
commit 65377d1
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Check Screenshot in PR | ||
|
||
on: | ||
pull_request: | ||
types: [opened, edited, synchronize] | ||
|
||
jobs: | ||
check-screenshot: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check if screenshot is attached | ||
id: check_screenshot | ||
run: | | ||
# Fetch the PR body (description) using jq | ||
PR_BODY=$(jq -r '.pull_request.body' "$GITHUB_EVENT_PATH") | ||
# Log the PR body for debugging (you can remove this later) | ||
echo "PR BODY: $PR_BODY" | ||
# Check if the PR body contains a GitHub-hosted image URL or image extensions (png, jpg, jpeg, gif) | ||
if echo "$PR_BODY" | grep -E "https://github.com/.+/assets/|\.png|\.jpg|\.jpeg|\.gif"; then | ||
echo "Screenshot found!" | ||
else | ||
echo "No screenshot found! Please attach a screenshot to your PR." | ||
exit 1 # Fail the workflow if no screenshot is found | ||
fi |