mirror of
https://github.com/iptv-org/iptv
synced 2026-09-09 05:17:04 -04:00
Create validate_issue.yml
This commit is contained in:
@@ -0,0 +1,56 @@
|
|||||||
|
name: Validate Issue
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [opened, edited]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
validate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: |
|
||||||
|
contains(github.event.issue.labels.*.name, 'streams:add') ||
|
||||||
|
contains(github.event.issue.labels.*.name, 'streams:remove') ||
|
||||||
|
contains(github.event.issue.labels.*.name, 'streams:edit')
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository code
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- uses: tibdex/github-app-token@v1.8.2
|
||||||
|
if: ${{ !env.ACT }}
|
||||||
|
id: create-app-token
|
||||||
|
with:
|
||||||
|
app_id: ${{ secrets.APP_ID }}
|
||||||
|
private_key: ${{ secrets.APP_PRIVATE_KEY }}
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 22
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Run issue:validate
|
||||||
|
id: validator
|
||||||
|
env:
|
||||||
|
RAW_BODY: ${{ github.event.issue.body }}
|
||||||
|
LABEL_STRING: ${{ join(github.event.issue.labels.*.name, ',') }}
|
||||||
|
run: |
|
||||||
|
npm run issue:validate -- \
|
||||||
|
--body "$RAW_BODY" \
|
||||||
|
--labels "$LABEL_STRING"
|
||||||
|
|
||||||
|
- name: Handle invalid request
|
||||||
|
if: failure() && steps.validator.outcome == 'failure'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ steps.create-app-token.outputs.token }}
|
||||||
|
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||||
|
run: |
|
||||||
|
COMMENT_MSG=$(cat temp/logs/errors.txt)
|
||||||
|
|
||||||
|
if [ "${{ env.ACT }}" = "true" ]; then
|
||||||
|
echo "[MOCK] Post comment:"
|
||||||
|
echo "$COMMENT_MSG"
|
||||||
|
else
|
||||||
|
gh issue comment $ISSUE_NUMBER --body "$COMMENT_MSG"
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user