Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1dbfe1ba55 | ||
|
|
15b3c5fd4d | ||
|
|
75f2492c00 | ||
|
|
cc18bea05f | ||
|
|
64bdb23066 | ||
|
|
ba7d609515 | ||
|
|
1d8459ca65 | ||
|
|
6a9caa2f7b | ||
|
|
92b352189b | ||
|
|
51a6bff8bc | ||
|
|
01781a83e5 | ||
|
|
6b06292965 | ||
|
|
dafa9ae191 | ||
|
|
07f2b50de7 | ||
|
|
55b296e932 |
71
.github/workflows/codeql-analysis.yml
vendored
Normal file
71
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
# For most projects, this workflow file will not need changing; you simply need
|
||||||
|
# to commit it to your repository.
|
||||||
|
#
|
||||||
|
# You may wish to alter this file to override the set of languages analyzed,
|
||||||
|
# or to provide custom queries or build logic.
|
||||||
|
#
|
||||||
|
# ******** NOTE ********
|
||||||
|
# We have attempted to detect the languages in your repository. Please check
|
||||||
|
# the `language` matrix defined below to confirm you have the correct set of
|
||||||
|
# supported CodeQL languages.
|
||||||
|
#
|
||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ main ]
|
||||||
|
schedule:
|
||||||
|
- cron: '31 5 * * 5'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: [ 'javascript' ]
|
||||||
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||||
|
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v2
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
source-root: src
|
||||||
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
|
# By default, queries listed here will override any specified in a config file.
|
||||||
|
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||||
|
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||||
|
|
||||||
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v2
|
||||||
|
|
||||||
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
|
# 📚 https://git.io/JvXDl
|
||||||
|
|
||||||
|
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||||
|
# and modify them (or add more) to build your code if your project
|
||||||
|
# uses a compiled language
|
||||||
|
|
||||||
|
#- run: |
|
||||||
|
# make bootstrap
|
||||||
|
# make release
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v2
|
||||||
27
.github/workflows/first-interaction.yml
vendored
Normal file
27
.github/workflows/first-interaction.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
name: first-interaction
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [opened]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
types: [opened]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check_for_first_interaction:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/first-interaction@main
|
||||||
|
with:
|
||||||
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
issue-message: |
|
||||||
|
Hello! Thank you for filing an issue.
|
||||||
|
|
||||||
|
If this is a bug report, please include relevant logs to help us debug the problem.
|
||||||
|
pr-message: |
|
||||||
|
Hello! Thank you for your contribution.
|
||||||
|
|
||||||
|
If you are fixing a bug, please reference the issue number in the description.
|
||||||
|
|
||||||
|
If you are implementing a feature request, please check with the maintainers that the feature will be accepted first.
|
||||||
2
.licenses/npm/@actions/core.dep.yml
generated
2
.licenses/npm/@actions/core.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/core"
|
name: "@actions/core"
|
||||||
version: 0.0.0
|
version: 1.10.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions core lib
|
summary: Actions core lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/master/packages/core
|
homepage: https://github.com/actions/toolkit/tree/master/packages/core
|
||||||
|
|||||||
2
.licenses/npm/@actions/exec.dep.yml
generated
2
.licenses/npm/@actions/exec.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/exec"
|
name: "@actions/exec"
|
||||||
version: 0.0.0
|
version: 1.1.1
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions exec lib
|
summary: Actions exec lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/master/packages/exec
|
homepage: https://github.com/actions/toolkit/tree/master/packages/exec
|
||||||
|
|||||||
2
.licenses/npm/@actions/github.dep.yml
generated
2
.licenses/npm/@actions/github.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/github"
|
name: "@actions/github"
|
||||||
version: 0.0.0
|
version: 5.1.1
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions github lib
|
summary: Actions github lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/master/packages/github
|
homepage: https://github.com/actions/toolkit/tree/master/packages/github
|
||||||
|
|||||||
2
.licenses/npm/@actions/io.dep.yml
generated
2
.licenses/npm/@actions/io.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/io"
|
name: "@actions/io"
|
||||||
version: 0.0.0
|
version: 1.1.2
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions io lib
|
summary: Actions io lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/master/packages/io
|
homepage: https://github.com/actions/toolkit/tree/master/packages/io
|
||||||
|
|||||||
2
.licenses/npm/@actions/tool-cache.dep.yml
generated
2
.licenses/npm/@actions/tool-cache.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/tool-cache"
|
name: "@actions/tool-cache"
|
||||||
version: 0.0.0
|
version: 2.0.1
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions tool-cache lib
|
summary: Actions tool-cache lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/master/packages/exec
|
homepage: https://github.com/actions/toolkit/tree/master/packages/exec
|
||||||
|
|||||||
1
CODEOWNERS
Normal file
1
CODEOWNERS
Normal file
@@ -0,0 +1 @@
|
|||||||
|
* @actions/actions-runtime
|
||||||
44
lib/main.js
44
lib/main.js
@@ -1,19 +1,32 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
if (k2 === undefined) k2 = k;
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
}) : (function(o, m, k, k2) {
|
||||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
if (k2 === undefined) k2 = k;
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
});
|
});
|
||||||
};
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
result["default"] = mod;
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const github = __importStar(require("@actions/github"));
|
const github = __importStar(require("@actions/github"));
|
||||||
@@ -26,7 +39,7 @@ function run() {
|
|||||||
throw new Error('Action must have at least one of issue-message or pr-message set');
|
throw new Error('Action must have at least one of issue-message or pr-message set');
|
||||||
}
|
}
|
||||||
// Get client and context
|
// Get client and context
|
||||||
const client = new github.GitHub(core.getInput('repo-token', { required: true }));
|
const client = github.getOctokit(core.getInput('repo-token', { required: true }));
|
||||||
const context = github.context;
|
const context = github.context;
|
||||||
if (context.payload.action !== 'opened') {
|
if (context.payload.action !== 'opened') {
|
||||||
console.log('No issue or PR was opened, skipping');
|
console.log('No issue or PR was opened, skipping');
|
||||||
@@ -66,7 +79,7 @@ function run() {
|
|||||||
// Add a comment to the appropriate place
|
// Add a comment to the appropriate place
|
||||||
console.log(`Adding message: ${message} to ${issueType} ${issue.number}`);
|
console.log(`Adding message: ${message} to ${issueType} ${issue.number}`);
|
||||||
if (isIssue) {
|
if (isIssue) {
|
||||||
yield client.issues.createComment({
|
yield client.rest.issues.createComment({
|
||||||
owner: issue.owner,
|
owner: issue.owner,
|
||||||
repo: issue.repo,
|
repo: issue.repo,
|
||||||
issue_number: issue.number,
|
issue_number: issue.number,
|
||||||
@@ -74,7 +87,7 @@ function run() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
yield client.pulls.createReview({
|
yield client.rest.pulls.createReview({
|
||||||
owner: issue.owner,
|
owner: issue.owner,
|
||||||
repo: issue.repo,
|
repo: issue.repo,
|
||||||
pull_number: issue.number,
|
pull_number: issue.number,
|
||||||
@@ -91,7 +104,7 @@ function run() {
|
|||||||
}
|
}
|
||||||
function isFirstIssue(client, owner, repo, sender, curIssueNumber) {
|
function isFirstIssue(client, owner, repo, sender, curIssueNumber) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const { status, data: issues } = yield client.issues.listForRepo({
|
const { status, data: issues } = yield client.rest.issues.listForRepo({
|
||||||
owner: owner,
|
owner: owner,
|
||||||
repo: repo,
|
repo: repo,
|
||||||
creator: sender,
|
creator: sender,
|
||||||
@@ -113,10 +126,11 @@ function isFirstIssue(client, owner, repo, sender, curIssueNumber) {
|
|||||||
}
|
}
|
||||||
// No way to filter pulls by creator
|
// No way to filter pulls by creator
|
||||||
function isFirstPull(client, owner, repo, sender, curPullNumber, page = 1) {
|
function isFirstPull(client, owner, repo, sender, curPullNumber, page = 1) {
|
||||||
|
var _a;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// Provide console output if we loop for a while.
|
// Provide console output if we loop for a while.
|
||||||
console.log('Checking...');
|
console.log('Checking...');
|
||||||
const { status, data: pulls } = yield client.pulls.list({
|
const { status, data: pulls } = yield client.rest.pulls.list({
|
||||||
owner: owner,
|
owner: owner,
|
||||||
repo: repo,
|
repo: repo,
|
||||||
per_page: 100,
|
per_page: 100,
|
||||||
@@ -130,7 +144,7 @@ function isFirstPull(client, owner, repo, sender, curPullNumber, page = 1) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (const pull of pulls) {
|
for (const pull of pulls) {
|
||||||
const login = pull.user.login;
|
const login = (_a = pull.user) === null || _a === void 0 ? void 0 : _a.login;
|
||||||
if (login === sender && pull.number < curPullNumber) {
|
if (login === sender && pull.number < curPullNumber) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
12
package.json
12
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "first-interaction-action",
|
"name": "first-interaction-action",
|
||||||
"version": "1.0.0",
|
"version": "1.2.0",
|
||||||
"description": "An action for greeting first time contributors.",
|
"description": "An action for greeting first time contributors.",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -26,11 +26,11 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/actions/first-interaction#readme",
|
"homepage": "https://github.com/actions/first-interaction#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "file:toolkit/actions-core-0.0.0.tgz",
|
"@actions/core": "file:toolkit/actions-core-1.10.0.tgz",
|
||||||
"@actions/exec": "file:toolkit/actions-exec-0.0.0.tgz",
|
"@actions/exec": "file:toolkit/actions-exec-1.1.1.tgz",
|
||||||
"@actions/github": "file:toolkit/actions-github-0.0.0.tgz",
|
"@actions/github": "file:toolkit/actions-github-5.1.1.tgz",
|
||||||
"@actions/io": "file:toolkit/actions-io-0.0.0.tgz",
|
"@actions/io": "file:toolkit/actions-io-1.1.2.tgz",
|
||||||
"@actions/tool-cache": "file:toolkit/actions-tool-cache-0.0.0.tgz"
|
"@actions/tool-cache": "file:toolkit/actions-tool-cache-2.0.1.tgz"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^24.0.13",
|
"@types/jest": "^24.0.13",
|
||||||
|
|||||||
18
src/main.ts
18
src/main.ts
@@ -11,7 +11,7 @@ async function run() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Get client and context
|
// Get client and context
|
||||||
const client: github.GitHub = new github.GitHub(
|
const client = github.getOctokit(
|
||||||
core.getInput('repo-token', {required: true})
|
core.getInput('repo-token', {required: true})
|
||||||
);
|
);
|
||||||
const context = github.context;
|
const context = github.context;
|
||||||
@@ -71,14 +71,14 @@ async function run() {
|
|||||||
// Add a comment to the appropriate place
|
// Add a comment to the appropriate place
|
||||||
console.log(`Adding message: ${message} to ${issueType} ${issue.number}`);
|
console.log(`Adding message: ${message} to ${issueType} ${issue.number}`);
|
||||||
if (isIssue) {
|
if (isIssue) {
|
||||||
await client.issues.createComment({
|
await client.rest.issues.createComment({
|
||||||
owner: issue.owner,
|
owner: issue.owner,
|
||||||
repo: issue.repo,
|
repo: issue.repo,
|
||||||
issue_number: issue.number,
|
issue_number: issue.number,
|
||||||
body: message
|
body: message
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await client.pulls.createReview({
|
await client.rest.pulls.createReview({
|
||||||
owner: issue.owner,
|
owner: issue.owner,
|
||||||
repo: issue.repo,
|
repo: issue.repo,
|
||||||
pull_number: issue.number,
|
pull_number: issue.number,
|
||||||
@@ -87,19 +87,19 @@ async function run() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed((error as any).message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function isFirstIssue(
|
async function isFirstIssue(
|
||||||
client: github.GitHub,
|
client: ReturnType<typeof github.getOctokit>,
|
||||||
owner: string,
|
owner: string,
|
||||||
repo: string,
|
repo: string,
|
||||||
sender: string,
|
sender: string,
|
||||||
curIssueNumber: number
|
curIssueNumber: number
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
const {status, data: issues} = await client.issues.listForRepo({
|
const {status, data: issues} = await client.rest.issues.listForRepo({
|
||||||
owner: owner,
|
owner: owner,
|
||||||
repo: repo,
|
repo: repo,
|
||||||
creator: sender,
|
creator: sender,
|
||||||
@@ -125,7 +125,7 @@ async function isFirstIssue(
|
|||||||
|
|
||||||
// No way to filter pulls by creator
|
// No way to filter pulls by creator
|
||||||
async function isFirstPull(
|
async function isFirstPull(
|
||||||
client: github.GitHub,
|
client: ReturnType<typeof github.getOctokit>,
|
||||||
owner: string,
|
owner: string,
|
||||||
repo: string,
|
repo: string,
|
||||||
sender: string,
|
sender: string,
|
||||||
@@ -134,7 +134,7 @@ async function isFirstPull(
|
|||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
// Provide console output if we loop for a while.
|
// Provide console output if we loop for a while.
|
||||||
console.log('Checking...');
|
console.log('Checking...');
|
||||||
const {status, data: pulls} = await client.pulls.list({
|
const {status, data: pulls} = await client.rest.pulls.list({
|
||||||
owner: owner,
|
owner: owner,
|
||||||
repo: repo,
|
repo: repo,
|
||||||
per_page: 100,
|
per_page: 100,
|
||||||
@@ -151,7 +151,7 @@ async function isFirstPull(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const pull of pulls) {
|
for (const pull of pulls) {
|
||||||
const login: string = pull.user.login;
|
const login = pull.user?.login;
|
||||||
if (login === sender && pull.number < curPullNumber) {
|
if (login === sender && pull.number < curPullNumber) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
BIN
toolkit/actions-core-1.10.0.tgz
Normal file
BIN
toolkit/actions-core-1.10.0.tgz
Normal file
Binary file not shown.
Binary file not shown.
BIN
toolkit/actions-exec-1.1.1.tgz
Normal file
BIN
toolkit/actions-exec-1.1.1.tgz
Normal file
Binary file not shown.
Binary file not shown.
BIN
toolkit/actions-github-5.1.1.tgz
Normal file
BIN
toolkit/actions-github-5.1.1.tgz
Normal file
Binary file not shown.
Binary file not shown.
BIN
toolkit/actions-io-1.1.2.tgz
Normal file
BIN
toolkit/actions-io-1.1.2.tgz
Normal file
Binary file not shown.
Binary file not shown.
BIN
toolkit/actions-tool-cache-2.0.1.tgz
Normal file
BIN
toolkit/actions-tool-cache-2.0.1.tgz
Normal file
Binary file not shown.
Reference in New Issue
Block a user