Skip to content

Verification Request: homebridge-swidget-fans #1278

Verification Request: homebridge-swidget-fans

Verification Request: homebridge-swidget-fans #1278

name: Plugin Checks (Request)
on:
workflow_dispatch:
inputs:
plugin:
description: Plugin Name
required: true
type: string
issues:
types:
- opened
issue_comment:
types:
- created
jobs:
check-plugin:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Check if should run
id: should-run
env:
COMMENT_BODY: ${{ github.event.comment.body }}
PLUGIN_INPUT: ${{ inputs.plugin }}
run: |
if [[ "${{ github.event_name }}" == "issues" ]] && [[ "${{ contains(github.event.issue.labels.*.name, 'request-verification') }}" == "true" ]]; then
echo "run=true" >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]] && [[ -n "$PLUGIN_INPUT" ]]; then
echo "run=true" >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == "issue_comment" ]]; then
FIRST_LINE=$(echo "$COMMENT_BODY" | head -n 1 | tr -d ' \t\r')
if [[ "$FIRST_LINE" == "/check" ]] && [[ "${{ contains(github.event.issue.labels.*.name, 'request-verification') }}" == "true" ]]; then
echo "run=true" >> $GITHUB_OUTPUT
echo "comment_id=${{ github.event.comment.id }}" >> $GITHUB_OUTPUT
else
echo "run=false" >> $GITHUB_OUTPUT
fi
else
echo "run=false" >> $GITHUB_OUTPUT
fi
- name: React with eyes emoji
if: steps.should-run.outputs.run == 'true' && github.event_name == 'issue_comment'
uses: actions/github-script@v8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: ${{ github.event.comment.id }},
content: 'eyes'
});
- name: Remove awaiting-final-review label
if: steps.should-run.outputs.run == 'true' && github.event_name == 'issue_comment'
uses: actions/github-script@v8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
name: 'awaiting-final-review'
});
console.log('Removed awaiting-final-review label');
} catch (error) {
console.log('Label awaiting-final-review not found or already removed');
}
- name: Install Dependencies & Build
if: steps.should-run.outputs.run == 'true'
run: npm install && npm run plugin-checks:build
- name: Extract Plugin Name
if: steps.should-run.outputs.run == 'true'
id: extract
env:
ISSUE_BODY: ${{ github.event.issue.body }}
PLUGIN_INPUT: ${{ inputs.plugin }}
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
PLUGIN_NAME="$PLUGIN_INPUT"
else
PLUGIN_NAME=$(echo "$ISSUE_BODY" | awk 'NR==3' | tr -d ' ')
fi
echo "PLUGIN_NAME=$PLUGIN_NAME" >> $GITHUB_ENV
- name: Check Plugin
if: steps.should-run.outputs.run == 'true'
uses: ./src/plugin-checks
with:
plugin: ${{ env.PLUGIN_NAME }}