Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
cf92c3ef8f | |||
37c316b457 | |||
71dbf25e22 | |||
cd707eb6c2 | |||
3feab3d957 | |||
4da9ea5179 | |||
0b2620a0ab | |||
c4889b9d7f | |||
ee905058f3 | |||
ba71d2e80a | |||
de53019210 | |||
95e4306edd | |||
196466972c | |||
9c4ccb8102 | |||
f0399d4d7e | |||
7cbbb9249a | |||
b26ba18a5b | |||
|
d0117a1be4 | ||
|
8c568c473d |
16
.eslintrc.json
Normal file
16
.eslintrc.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es6": true
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"globals": {
|
||||||
|
"Atomics": "readonly",
|
||||||
|
"SharedArrayBuffer": "readonly"
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 14
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
}
|
||||||
|
}
|
34
.gitea/workflows/lint.yaml
Normal file
34
.gitea/workflows/lint.yaml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
name: Lint
|
||||||
|
|
||||||
|
on:
|
||||||
|
# Trigger the workflow on push or pull request,
|
||||||
|
# but only for the main branch
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run-linters:
|
||||||
|
name: Run linters
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: apt update; apt install -y nodejs eslint
|
||||||
|
|
||||||
|
- name: Check out Git repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 14
|
||||||
|
|
||||||
|
- name: Install Node.js dependencies
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: Run eslint
|
||||||
|
run: eslint *.js
|
130
.gitignore
vendored
Normal file
130
.gitignore
vendored
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
.pnpm-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# Snowpack dependency directory (https://snowpack.dev/)
|
||||||
|
web_modules/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional stylelint cache
|
||||||
|
.stylelintcache
|
||||||
|
|
||||||
|
# Microbundle cache
|
||||||
|
.rpt2_cache/
|
||||||
|
.rts2_cache_cjs/
|
||||||
|
.rts2_cache_es/
|
||||||
|
.rts2_cache_umd/
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variable files
|
||||||
|
.env
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
.env.local
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
.parcel-cache
|
||||||
|
|
||||||
|
# Next.js build output
|
||||||
|
.next
|
||||||
|
out
|
||||||
|
|
||||||
|
# Nuxt.js build / generate output
|
||||||
|
.nuxt
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Gatsby files
|
||||||
|
.cache/
|
||||||
|
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||||
|
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||||
|
# public
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# vuepress v2.x temp and cache directory
|
||||||
|
.temp
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# Docusaurus cache and generated files
|
||||||
|
.docusaurus
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|
||||||
|
# TernJS port file
|
||||||
|
.tern-port
|
||||||
|
|
||||||
|
# Stores VSCode versions used for testing VSCode extensions
|
||||||
|
.vscode-test
|
||||||
|
|
||||||
|
# yarn v2
|
||||||
|
.yarn/cache
|
||||||
|
.yarn/unplugged
|
||||||
|
.yarn/build-state.yml
|
||||||
|
.yarn/install-state.gz
|
||||||
|
.pnp.*
|
@@ -44,8 +44,6 @@ const giteaEvents = {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
content: {
|
content: {
|
||||||
icon_url: user.avatar_url,
|
|
||||||
alias: user.login,
|
|
||||||
text: text
|
text: text
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -64,8 +62,6 @@ const giteaEvents = {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
content: {
|
content: {
|
||||||
icon_url: user.avatar_url,
|
|
||||||
alias: user.login,
|
|
||||||
text: text
|
text: text
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -78,8 +74,6 @@ const giteaEvents = {
|
|||||||
const text = "Forked from **[" + forkee.full_name + '](' + forkee.html_url + ')** to **[' + repo.full_name + '](' + repo.html_url + ')**';
|
const text = "Forked from **[" + forkee.full_name + '](' + forkee.html_url + ')** to **[' + repo.full_name + '](' + repo.html_url + ')**';
|
||||||
return {
|
return {
|
||||||
content: {
|
content: {
|
||||||
icon_url: user.avatar_url,
|
|
||||||
alias: user.login,
|
|
||||||
text: text
|
text: text
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -100,9 +94,10 @@ const giteaEvents = {
|
|||||||
for (var i = 0; i < commits.length; i++) {
|
for (var i = 0; i < commits.length; i++) {
|
||||||
var commit = commits[i];
|
var commit = commits[i];
|
||||||
var shortID = commit.id.substring(0, 7);
|
var shortID = commit.id.substring(0, 7);
|
||||||
output = '[#' + shortID + '](' + commit.url + '): \n' + commit.message
|
|
||||||
attachment.fields.push({
|
attachment.fields.push({
|
||||||
value: output,
|
short: false,
|
||||||
|
title: '[#' + shortID + '](' + commit.url + '): \n',
|
||||||
|
value: commit.message,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,8 +107,6 @@ const giteaEvents = {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
content: {
|
content: {
|
||||||
icon_url: user.avatar_url,
|
|
||||||
alias: user.login,
|
|
||||||
text: text,
|
text: text,
|
||||||
attachments: [attachment]
|
attachments: [attachment]
|
||||||
}
|
}
|
||||||
@@ -142,8 +135,6 @@ const giteaEvents = {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
content: {
|
content: {
|
||||||
icon_url: user.avatar_url,
|
|
||||||
alias: user.login,
|
|
||||||
text: text
|
text: text
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -170,8 +161,6 @@ const giteaEvents = {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
content: {
|
content: {
|
||||||
icon_url: user.avatar_url,
|
|
||||||
alias: user.login,
|
|
||||||
text: text
|
text: text
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -213,8 +202,6 @@ const giteaEvents = {
|
|||||||
is.html_url + ')** ' + 'at [' + repo.full_name + '](' + repo.html_url + ')\n\n';
|
is.html_url + ')** ' + 'at [' + repo.full_name + '](' + repo.html_url + ')\n\n';
|
||||||
return {
|
return {
|
||||||
content: {
|
content: {
|
||||||
icon_url: user.avatar_url,
|
|
||||||
alias: user.login,
|
|
||||||
text: text,
|
text: text,
|
||||||
attachments: [{
|
attachments: [{
|
||||||
text: body
|
text: body
|
||||||
@@ -270,8 +257,6 @@ const giteaEvents = {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
content: {
|
content: {
|
||||||
icon_url: user.avatar_url,
|
|
||||||
alias: user.login,
|
|
||||||
text: text,
|
text: text,
|
||||||
attachments: [
|
attachments: [
|
||||||
{
|
{
|
||||||
@@ -296,14 +281,17 @@ const giteaEvents = {
|
|||||||
var body = "Current labels: " + getLabelsField(pr.labels).value;
|
var body = "Current labels: " + getLabelsField(pr.labels).value;
|
||||||
} else if (action == "assigned" || action == "unassigned") {
|
} else if (action == "assigned" || action == "unassigned") {
|
||||||
if (pr.assignee) {
|
if (pr.assignee) {
|
||||||
var body = "Current assignee: " + getAssigneesField(pr.assignees).value;
|
var assign_text = "Current assignee: " + getAssigneesField(pr.assignees).value;
|
||||||
} else {
|
} else {
|
||||||
var body = "There is no assignee";
|
var assign_text = "There is no assignee";
|
||||||
}
|
}
|
||||||
} else if (action == "closed") {
|
} else if (action == "closed") {
|
||||||
if (pr.merged) {
|
if (pr.merged) {
|
||||||
var body = "Merged by: " + pr.merged_by.login;
|
var body = "Merged by: " + pr.merged_by.login;
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
var body = "Not merged pull request"
|
||||||
|
}
|
||||||
} else if (action == "milestoned" || action == "demilestoned") {
|
} else if (action == "milestoned" || action == "demilestoned") {
|
||||||
var body = "Milestone: [" + pr.milestone.title + "](" + repo.html_url + "/milestone/" + pr.milestone.id + ")";
|
var body = "Milestone: [" + pr.milestone.title + "](" + repo.html_url + "/milestone/" + pr.milestone.id + ")";
|
||||||
} else if (action == "synchronized"){
|
} else if (action == "synchronized"){
|
||||||
@@ -316,15 +304,20 @@ const giteaEvents = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const text =
|
if(assign_text){
|
||||||
|
var text =
|
||||||
|
action.capitalizeFirstLetter() + ' **[pull request #' + pr.number +
|
||||||
|
' - ' + pr.title + '](' +
|
||||||
|
pr.html_url + ')**' + ' at [' + repo.full_name + '](' + repo.html_url + ')\n\n'+ assign_text;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
var text =
|
||||||
action.capitalizeFirstLetter() + ' **[pull request #' + pr.number +
|
action.capitalizeFirstLetter() + ' **[pull request #' + pr.number +
|
||||||
' - ' + pr.title + '](' +
|
' - ' + pr.title + '](' +
|
||||||
pr.html_url + ')**' + ' at [' + repo.full_name + '](' + repo.html_url + ')\n\n';
|
pr.html_url + ')**' + ' at [' + repo.full_name + '](' + repo.html_url + ')\n\n';
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
content: {
|
content: {
|
||||||
icon_url: user.avatar_url,
|
|
||||||
alias: user.login,
|
|
||||||
text: text,
|
text: text,
|
||||||
attachments: [
|
attachments: [
|
||||||
{
|
{
|
||||||
@@ -347,8 +340,6 @@ const giteaEvents = {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
content: {
|
content: {
|
||||||
icon_url: user.avatar_url,
|
|
||||||
alias: user.login,
|
|
||||||
text: text,
|
text: text,
|
||||||
attachments: [
|
attachments: [
|
||||||
{
|
{
|
||||||
@@ -370,8 +361,6 @@ const giteaEvents = {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
content: {
|
content: {
|
||||||
icon_url: user.avatar_url,
|
|
||||||
alias: user.login,
|
|
||||||
text: text,
|
text: text,
|
||||||
attachments: [
|
attachments: [
|
||||||
{
|
{
|
||||||
|
124
package.json
Normal file
124
package.json
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
{
|
||||||
|
"name": "rocketchat-gitea-hook",
|
||||||
|
"version": "1.15.0",
|
||||||
|
"description": "Rocket.Chat integrate Gitea's notifications via Incoming Webhook",
|
||||||
|
"main": "gitea-rocketchat.hooks.js",
|
||||||
|
"dependencies": {
|
||||||
|
"acorn-jsx": "^5.3.2",
|
||||||
|
"ajv": "^6.12.6",
|
||||||
|
"ansi-regex": "^5.0.1",
|
||||||
|
"ansi-styles": "^4.3.0",
|
||||||
|
"are-docs-informative": "^0.0.2",
|
||||||
|
"argparse": "^2.0.1",
|
||||||
|
"balanced-match": "^1.0.2",
|
||||||
|
"brace-expansion": "^1.1.11",
|
||||||
|
"callsites": "^3.1.0",
|
||||||
|
"chalk": "^4.1.2",
|
||||||
|
"color-convert": "^2.0.1",
|
||||||
|
"color-name": "^1.1.4",
|
||||||
|
"comment-parser": "^1.3.1",
|
||||||
|
"concat-map": "^0.0.1",
|
||||||
|
"cross-spawn": "^7.0.3",
|
||||||
|
"debug": "^4.3.4",
|
||||||
|
"deep-is": "^0.1.4",
|
||||||
|
"doctrine": "^3.0.0",
|
||||||
|
"escape-string-regexp": "^4.0.0",
|
||||||
|
"eslint-plugin-jsdoc": "^43.1.1",
|
||||||
|
"eslint-scope": "^7.2.0",
|
||||||
|
"eslint-visitor-keys": "^3.4.0",
|
||||||
|
"espree": "^9.5.1",
|
||||||
|
"esquery": "^1.5.0",
|
||||||
|
"esrecurse": "^4.3.0",
|
||||||
|
"estraverse": "^5.3.0",
|
||||||
|
"esutils": "^2.0.3",
|
||||||
|
"fast-deep-equal": "^3.1.3",
|
||||||
|
"fast-json-stable-stringify": "^2.1.0",
|
||||||
|
"fast-levenshtein": "^2.0.6",
|
||||||
|
"fastq": "^1.15.0",
|
||||||
|
"file-entry-cache": "^6.0.1",
|
||||||
|
"find-up": "^5.0.0",
|
||||||
|
"flat-cache": "^3.0.4",
|
||||||
|
"flatted": "^3.2.7",
|
||||||
|
"fs.realpath": "^1.0.0",
|
||||||
|
"glob": "^7.2.3",
|
||||||
|
"glob-parent": "^6.0.2",
|
||||||
|
"globals": "^13.20.0",
|
||||||
|
"grapheme-splitter": "^1.0.4",
|
||||||
|
"has-flag": "^4.0.0",
|
||||||
|
"ignore": "^5.2.4",
|
||||||
|
"import-fresh": "^3.3.0",
|
||||||
|
"imurmurhash": "^0.1.4",
|
||||||
|
"inflight": "^1.0.6",
|
||||||
|
"inherits": "^2.0.4",
|
||||||
|
"is-extglob": "^2.1.1",
|
||||||
|
"is-glob": "^4.0.3",
|
||||||
|
"is-path-inside": "^3.0.3",
|
||||||
|
"isexe": "^2.0.0",
|
||||||
|
"js-sdsl": "^4.4.0",
|
||||||
|
"js-yaml": "^4.1.0",
|
||||||
|
"jsdoc-type-pratt-parser": "^4.0.0",
|
||||||
|
"json-schema-traverse": "^0.4.1",
|
||||||
|
"json-stable-stringify-without-jsonify": "^1.0.1",
|
||||||
|
"levn": "^0.4.1",
|
||||||
|
"locate-path": "^6.0.0",
|
||||||
|
"lodash.merge": "^4.6.2",
|
||||||
|
"lru-cache": "^6.0.0",
|
||||||
|
"minimatch": "^3.1.2",
|
||||||
|
"ms": "^2.1.2",
|
||||||
|
"natural-compare": "^1.4.0",
|
||||||
|
"once": "^1.4.0",
|
||||||
|
"optionator": "^0.9.1",
|
||||||
|
"p-limit": "^3.1.0",
|
||||||
|
"p-locate": "^5.0.0",
|
||||||
|
"parent-module": "^1.0.1",
|
||||||
|
"path-exists": "^4.0.0",
|
||||||
|
"path-is-absolute": "^1.0.1",
|
||||||
|
"path-key": "^3.1.1",
|
||||||
|
"prelude-ls": "^1.2.1",
|
||||||
|
"prettier": "^2.8.8",
|
||||||
|
"punycode": "^2.3.0",
|
||||||
|
"queue-microtask": "^1.2.3",
|
||||||
|
"resolve-from": "^4.0.0",
|
||||||
|
"reusify": "^1.0.4",
|
||||||
|
"rimraf": "^3.0.2",
|
||||||
|
"run-parallel": "^1.2.0",
|
||||||
|
"semver": "^7.5.0",
|
||||||
|
"shebang-command": "^2.0.0",
|
||||||
|
"shebang-regex": "^3.0.0",
|
||||||
|
"spdx-exceptions": "^2.3.0",
|
||||||
|
"spdx-expression-parse": "^3.0.1",
|
||||||
|
"spdx-license-ids": "^3.0.13",
|
||||||
|
"strip-ansi": "^6.0.1",
|
||||||
|
"strip-json-comments": "^3.1.1",
|
||||||
|
"supports-color": "^7.2.0",
|
||||||
|
"text-table": "^0.2.0",
|
||||||
|
"type-check": "^0.4.0",
|
||||||
|
"type-fest": "^0.20.2",
|
||||||
|
"uri-js": "^4.4.1",
|
||||||
|
"which": "^2.0.2",
|
||||||
|
"word-wrap": "^1.2.3",
|
||||||
|
"wrappy": "^1.0.2",
|
||||||
|
"yallist": "^4.0.0",
|
||||||
|
"yocto-queue": "^0.1.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "npm test"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git@git.sporq.de:sporq/rocketchat-gitea-hook.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"notifications",
|
||||||
|
"webhooks",
|
||||||
|
"webhook",
|
||||||
|
"gitea",
|
||||||
|
"rocketchat",
|
||||||
|
"incoming-webhooks"
|
||||||
|
],
|
||||||
|
"author": "Austin Su",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^8.39.0"
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user