Skip to content

remove tg notifications due to lack of acces to secrets for forked pu… #176

remove tg notifications due to lack of acces to secrets for forked pu…

remove tg notifications due to lack of acces to secrets for forked pu… #176

Workflow file for this run

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 and Notify on Telegram
# env:
# TELEGRAM_BOT_TOKEN: ${{ secrets.BOTTOKEN }}
# TELEGRAM_CHAT_ID: ${{ secrets.CHATID }}
steps:

Check failure on line 32 in .github/workflows/main.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/main.yml

Invalid workflow file

You have an error in your yaml syntax on line 32
- 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
# - name: Prepare Notification Message
# if: success() # This will proceed only if the previous validation step was successful
# run: |
# message=""
# pr_link="${{ github.event.pull_request.html_url }}"
# if [ "${{ github.event_name }}" == "pull_request" ]; then
# if [ "${{ github.event.action }}" == "opened" ]; then
# message="🚀 New PR created: #${{ github.event.pull_request.number }} by ${{ github.event.pull_request.user.login }} - $pr_link"
# elif [ "${{ github.event.action }}" == "ready_for_review" ]; then
# message="📝 PR is ready for review: #${{ github.event.pull_request.number }} - $pr_link"
# elif [ "${{ github.event.action }}" == "reopened" ]; then
# message="🔄 PR reopened: #${{ github.event.pull_request.number }} - $pr_link"
# elif [ "${{ github.event.action }}" == "closed" ] && [ "${{ github.event.pull_request.merged }}" == "true" ]; then
# message="✅ PR merged: #${{ github.event.pull_request.number }} - $pr_link"
# elif [ "${{ github.event.action }}" == "closed" ] && [ "${{ github.event.pull_request.merged }}" == "false" ]; then
# message="❌ PR closed without merging: #${{ github.event.pull_request.number }} - $pr_link"
# fi
# elif [ "${{ github.event_name }}" == "pull_request_review" ] && [ "${{ github.event.review.state }}" == "approved" ]; then
# message="👍 PR approved by ${{ github.event.review.user.login }}: #${{ github.event.pull_request.number }} - $pr_link"
# fi
# if [ -z "$message" ]; then
# echo "No relevant action taken, skipping notification."
# exit 0
# fi
# echo "TG_SENDER_PAYLOAD_MESSAGE=$message" >> $GITHUB_ENV
# - name: Verify Secret Access
# run: |
# if [ -n "${{ secrets.BOTTOKEN }}" ] && [ -n "${{ secrets.CHATID }}" ]; then
# echo "Secrets appear to be set"
# else
# echo "One or both secrets are not set"
# exit 1
# fi
# - name: Send Notification to Telegram
# if: env.TG_SENDER_PAYLOAD_MESSAGE != '' && success()
# env:
# TELEGRAM_BOT_TOKEN: ${{ secrets.BOTTOKEN }}
# TELEGRAM_CHAT_ID: ${{ secrets.CHATID }}
# run: |
# response=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
# -H "Content-Type: application/json" \
# -d "{\"chat_id\": \"$TELEGRAM_CHAT_ID\", \"text\": \"$TG_SENDER_PAYLOAD_MESSAGE\"}" \
# "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage")
# if [ "$response" = "200" ]; then
# echo "Message sent successfully"
# else
# echo "Failed to send message. HTTP status code: $response"
# exit 1
# fi
# if: env.TG_SENDER_PAYLOAD_MESSAGE != '' && success()
# run: |
# curl -X POST \
# -H "Content-Type: application/json" \
# -d '{"chat_id": "${{ secrets.CHATID }}", "text": "${{ env.TG_SENDER_PAYLOAD_MESSAGE }}"}' \
# "https://api.telegram.org/bot${{ secrets.BotToken }}/sendMessage"