chore(validateTags): remove @actions/github

This commit is contained in:
xHyroM 2022-07-16 15:43:46 +02:00
parent 33f4111c6e
commit d5389a6757
4 changed files with 5 additions and 9 deletions

View file

@ -30,4 +30,5 @@ jobs:
run: bun run validate
env:
github-token: ${{ secrets.GITHUB_TOKEN }}
commit-sha: ${{ github.event.pull_request.head.sha }}
commit-sha: ${{ github.event.pull_request.head.sha }}
pr-number: ${{ github.event.pull_request.number }}

Binary file not shown.

View file

@ -2,9 +2,5 @@
"name": "validate-tags",
"scripts": {
"start": "bun src/index.ts"
},
"dependencies": {
"@actions/core": "^1.9.0",
"@actions/github": "^5.0.3"
}
}

View file

@ -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',