PR Validation and Notifications #330
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 Validation and Notifications | |
on: | |
pull_request: | |
types: [opened, ready_for_review, review_requested, reopened, closed, synchronize] | |
pull_request_review: | |
types: [submitted] | |
jobs: | |
log_info: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Log PR Info | |
run: | | |
if [ "${{ github.event_name }}" == "pull_request_review" ]; then | |
echo "PR Number: ${{ github.event.pull_request.number }}" | |
echo "Action: ${{ github.event.review.state }}" | |
elif [ "${{ github.event_name }}" == "pull_request" ]; then | |
echo "PR Number: ${{ github.event.number }}" | |
echo "Action: ${{ github.event.action }}" | |
else | |
echo "Unhandled event type: ${{ github.event_name }}" | |
fi | |
validate_and_notify: | |
runs-on: ubuntu-latest | |
name: Validate JSON | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout Code | |
- name: Check Required Files in Subfolders | |
id: check_files | |
run: | | |
missing_files=false | |
error_message="Missing required files: " | |
# Check each subfolder for info.json, logo.png, and metadata.json | |
for dir in tokens/psp22/*; do | |
if [ ! -d "$dir" ]; then continue; fi # Skip if not a directory | |
echo "Checking directory: $dir" | |
if [ ! -f "$dir/info.json" ]; then | |
missing_files=true | |
error_message="${error_message}info.json is missing in $dir " | |
fi | |
if [ ! -f "$dir/logo.png" ]; then | |
missing_files=true | |
error_message="${error_message}logo.png is missing in $dir " | |
fi | |
if [ ! -f "$dir/metadata.json" ]; then | |
missing_files=true | |
error_message="${error_message}metadata.json is missing in $dir " | |
fi | |
done | |
if [ "$missing_files" = true ]; then | |
echo "$error_message" | |
exit 1 | |
fi | |
- name: JSON/YAML Validation | |
uses: GrantBirki/json-yaml-validate@v2.7.1 | |
with: | |
comment: "true" # This will post a comment if the validation fails |