test #12
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: Issue Listener | |
on: | |
issues: | |
types: | |
- opened | |
- edited | |
issue_comment: | |
types: | |
- created | |
- edited | |
jobs: | |
check-issue: | |
name: Check Issue | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.37.2 | |
- name: Check Issue and Comment | |
id: check | |
uses: actions/github-script@v5 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const issue = context.payload.issue; | |
const comment = context.payload.comment; | |
const description = issue.body; | |
if (description.includes('#request-upload-plugin')) { | |
const commentBody = comment.body.toLowerCase(); | |
if (commentBody.includes('accept')) { | |
console.log('Accepted issue:', issue.number); | |
return { id: issue.number, user: issue.user.login } | |
} else { | |
console.log('Issue not accepted:', issue.number); | |
return false | |
} | |
} | |
- name: Setup env | |
run: | | |
echo '' > .env | |
echo 'OK_OWNER="manga-raiku"' >> .env | |
echo 'OK_REPO="service-market-raiku"' >> .env | |
echo 'OK_BRANCH="main"' >> .env | |
- name: Run scripts upload plugin | |
id: run | |
if: steps.check.outputs.result != 'false' | |
run: deno run --allow-read --allow-env --allow-net ./scripts/upload-plugin.ts ${{ steps.check.outputs.result.user }} ${{ steps.check.outputs.result.id }} |