[New Plugin]: binja-win-docs #35
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: Validate New Plugin Repository | |
on: | |
issues: | |
types: [opened] | |
jobs: | |
run: | |
name: ValidateRepo | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Check Issue Label | |
id: check-label | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
const labels = context.payload.issue.labels; | |
const hasLabel = labels.some(label => label.name === 'new plugin'); | |
if (!hasLabel) { | |
core.setOutput('skipRemainingSteps', 'true'); | |
} | |
- name: Install dependencies | |
if: steps.check-label.outputs.skipRemainingSteps != 'true' | |
run: pip install -r requirements.txt | |
- name: Run Validator | |
if: steps.check-label.outputs.skipRemainingSteps != 'true' | |
run: python3 validate_json.py ${{ secrets.M_GITHUB_TOKEN }} | |
env: | |
ISSUE_CONTENT: ${{ github.event.issue.body }} | |
- name: Comment | |
if: (steps.check-label.outputs.skipRemainingSteps != 'true') && (failure()) | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `Sorry, this repository does not appear to have a valid plugin.json. | |
Please ensure it is valid JSON and that you have created an actual release. | |
` | |
}) | |
await github.rest.issues.addLabels({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: ['invalid'] | |
}) | |
await github.rest.issues.update({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
state: 'closed' | |
}) |