diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 9f475db..5c808bb 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -30,4 +30,5 @@ jobs: run: bun run validate env: github-token: ${{ secrets.GITHUB_TOKEN }} - commit-sha: ${{ github.event.pull_request.head.sha }} \ No newline at end of file + commit-sha: ${{ github.event.pull_request.head.sha }} + pr-number: ${{ github.event.pull_request.number }} \ No newline at end of file diff --git a/scripts/validateTags/bun.lockb b/scripts/validateTags/bun.lockb deleted file mode 100755 index 9af4d02..0000000 Binary files a/scripts/validateTags/bun.lockb and /dev/null differ diff --git a/scripts/validateTags/package.json b/scripts/validateTags/package.json index 3e2db33..5d0430d 100644 --- a/scripts/validateTags/package.json +++ b/scripts/validateTags/package.json @@ -2,9 +2,5 @@ "name": "validate-tags", "scripts": { "start": "bun src/index.ts" - }, - "dependencies": { - "@actions/core": "^1.9.0", - "@actions/github": "^5.0.3" } } \ No newline at end of file diff --git a/scripts/validateTags/src/index.ts b/scripts/validateTags/src/index.ts index 92bdba8..5ceb62b 100644 --- a/scripts/validateTags/src/index.ts +++ b/scripts/validateTags/src/index.ts @@ -1,5 +1,3 @@ -import { context } from '@actions/github'; - interface Tag { keywords: string[]; content: string; @@ -7,6 +5,7 @@ interface Tag { const githubToken = process.env['github-token']; const commitSha = process.env['commit-sha']; +const pullRequestNumber = process.env['pr-number']; const codeBlockRegex = /(`{1,3}).+?\1/gs; const urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&\/\/=]*)/gi; @@ -50,7 +49,7 @@ for (const [key, value] of Object.entries(tags)) { } if (errors.length === 0) { - fetch(`https://api.github.com/repos/${context.repo.owner}/${context.repo.repo}/pulls/${context.payload.pull_request.number}/reviews`, { + fetch(`https://api.github.com/repos/xHyroM/bun-discord-bot/pulls/${pullRequestNumber}/reviews`, { method: 'POST', headers: { 'Accept': 'application/vnd.github+json', @@ -62,7 +61,7 @@ if (errors.length === 0) { }) }) } else { - fetch(`https://api.github.com/repos/${context.repo.owner}/${context.repo.repo}/pulls/${context.payload.pull_request.number}/reviews`, { + fetch(`https://api.github.com/repos/xHyroM/bun-discord-bot/pulls/${pullRequestNumber}/reviews`, { method: 'POST', headers: { 'Accept': 'application/vnd.github+json',