Edit: Az Cinema Logo #4608
This file contains hidden or 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: Validate Issue | |
| on: | |
| issues: | |
| types: [opened, edited] | |
| permissions: | |
| contents: read | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| if: | | |
| contains(join(github.event.issue.labels.*.name, ','), 'channels:') || | |
| contains(join(github.event.issue.labels.*.name, ','), 'feeds:') || | |
| contains(join(github.event.issue.labels.*.name, ','), 'logos:') || | |
| contains(join(github.event.issue.labels.*.name, ','), 'cities:') || | |
| contains(join(github.event.issue.labels.*.name, ','), 'blocklist:') | |
| steps: | |
| - name: Checkout repository code | |
| uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 | |
| - uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2.2.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@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| 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 valid request | |
| if: success() | |
| env: | |
| GH_TOKEN: ${{ steps.create-app-token.outputs.token }} | |
| ISSUE_NUMBER: ${{ github.event.issue.number }} | |
| run: | | |
| if [ "${{ env.ACT }}" = "true" ]; then | |
| echo "[MOCK] Add label: check:passed" | |
| echo "[MOCK] Remove label if exists: check:failed" | |
| else | |
| gh issue edit $ISSUE_NUMBER --add-label "check:passed" --remove-label "check:failed" | |
| fi | |
| - 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" | |
| echo "[MOCK] Add label: check:failed" | |
| echo "[MOCK] Remove label if exists: check:passed" | |
| else | |
| gh issue comment $ISSUE_NUMBER --body "$COMMENT_MSG" | |
| gh issue edit $ISSUE_NUMBER --add-label "check:failed" --remove-label "check:passed" | |
| fi |