mirror of
https://github.com/xHyroM/bun-discord-bot.git
synced 2024-11-22 14:41:05 +01:00
chore(validateTags): remove @actions/github
This commit is contained in:
parent
33f4111c6e
commit
d5389a6757
4 changed files with 5 additions and 9 deletions
1
.github/workflows/validate.yml
vendored
1
.github/workflows/validate.yml
vendored
|
@ -31,3 +31,4 @@ jobs:
|
||||||
env:
|
env:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
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.
|
@ -2,9 +2,5 @@
|
||||||
"name": "validate-tags",
|
"name": "validate-tags",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "bun src/index.ts"
|
"start": "bun src/index.ts"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@actions/core": "^1.9.0",
|
|
||||||
"@actions/github": "^5.0.3"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,3 @@
|
||||||
import { context } from '@actions/github';
|
|
||||||
|
|
||||||
interface Tag {
|
interface Tag {
|
||||||
keywords: string[];
|
keywords: string[];
|
||||||
content: string;
|
content: string;
|
||||||
|
@ -7,6 +5,7 @@ interface Tag {
|
||||||
|
|
||||||
const githubToken = process.env['github-token'];
|
const githubToken = process.env['github-token'];
|
||||||
const commitSha = process.env['commit-sha'];
|
const commitSha = process.env['commit-sha'];
|
||||||
|
const pullRequestNumber = process.env['pr-number'];
|
||||||
|
|
||||||
const codeBlockRegex = /(`{1,3}).+?\1/gs;
|
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;
|
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) {
|
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',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'application/vnd.github+json',
|
'Accept': 'application/vnd.github+json',
|
||||||
|
@ -62,7 +61,7 @@ if (errors.length === 0) {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
} else {
|
} 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',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'application/vnd.github+json',
|
'Accept': 'application/vnd.github+json',
|
||||||
|
|
Loading…
Reference in a new issue