Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c4688942c | ||
|
|
76a99ddc54 | ||
|
|
2ead13ce86 | ||
|
|
2e8e20081d | ||
|
|
df55979d04 | ||
|
|
c056c1801c | ||
|
|
dac371d2f4 | ||
|
|
33689d3bf6 | ||
|
|
8e69b57fc5 | ||
|
|
69c5373796 | ||
|
|
dcfeffc0c7 | ||
|
|
fb54a3d8ae | ||
|
|
4618d4d5bb | ||
|
|
6b35c8253b | ||
|
|
6cea8723ea | ||
|
|
f44c11ebd1 | ||
|
|
f598f6795f | ||
|
|
060edb2b27 | ||
|
|
77cbbd906f | ||
|
|
14f252a1f6 | ||
|
|
ad93111721 | ||
|
|
dad370b79a | ||
|
|
8000bc50c7 | ||
|
|
82f80dfd18 | ||
|
|
c4df7d4167 | ||
|
|
9307c29682 | ||
|
|
4c76148459 | ||
|
|
cf5cf8763f | ||
|
|
b29d168c60 | ||
|
|
fe703bdd34 | ||
|
|
3346972303 | ||
|
|
551d20915e | ||
|
|
843400517f | ||
|
|
d1cde71cbb | ||
|
|
0972aa989b |
4
.github/workflows/check-dist.yml
vendored
4
.github/workflows/check-dist.yml
vendored
@@ -28,11 +28,11 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
id: checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Setup Node.js
|
||||
id: setup-node
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: .node-version
|
||||
cache: npm
|
||||
|
||||
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@@ -30,7 +30,7 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
id: checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Initialize CodeQL
|
||||
id: initialize
|
||||
|
||||
4
.github/workflows/continuous-integration.yml
vendored
4
.github/workflows/continuous-integration.yml
vendored
@@ -18,11 +18,11 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
id: checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Setup Node.js
|
||||
id: setup-node
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: .node-version
|
||||
cache: npm
|
||||
|
||||
6
.github/workflows/first-interaction.yml
vendored
6
.github/workflows/first-interaction.yml
vendored
@@ -22,12 +22,12 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/first-interaction@main
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-message: |
|
||||
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: |
|
||||
pr_message: |
|
||||
Hello! Thank you for your contribution.
|
||||
|
||||
If you are fixing a bug, please reference the issue number in the description.
|
||||
|
||||
4
.github/workflows/licensed.yml
vendored
4
.github/workflows/licensed.yml
vendored
@@ -24,11 +24,11 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
id: checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Setup Node.js
|
||||
id: setup-node
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: .node-version
|
||||
cache: npm
|
||||
|
||||
7
.github/workflows/linter.yml
vendored
7
.github/workflows/linter.yml
vendored
@@ -21,13 +21,13 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
id: checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node.js
|
||||
id: setup-node
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: .node-version
|
||||
cache: npm
|
||||
@@ -45,6 +45,9 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
LINTER_RULES_PATH: .
|
||||
VALIDATE_ALL_CODEBASE: true
|
||||
VALIDATE_BIOME_FORMAT: false
|
||||
VALIDATE_BIOME_LINT: false
|
||||
VALIDATE_GITHUB_ACTIONS_ZIZMOR: false
|
||||
VALIDATE_JAVASCRIPT_ES: false
|
||||
VALIDATE_JSCPD: false
|
||||
VALIDATE_TYPESCRIPT_ES: false
|
||||
|
||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
id: checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-tags: true
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ export const context = {
|
||||
number: 10
|
||||
},
|
||||
payload: {
|
||||
action: 'opened',
|
||||
number: 10,
|
||||
issue: {
|
||||
number: 10
|
||||
@@ -19,7 +20,6 @@ export const context = {
|
||||
login: 'mona'
|
||||
}
|
||||
},
|
||||
action: 'opened',
|
||||
repo: {
|
||||
owner: 'actions',
|
||||
repo: 'first-interaction'
|
||||
|
||||
@@ -30,7 +30,7 @@ describe('main.ts', () => {
|
||||
beforeEach(() => {
|
||||
// "Reset" the github context.
|
||||
github.context.eventName = 'pull_request'
|
||||
github.context.action = 'opened'
|
||||
github.context.payload.action = 'opened'
|
||||
github.context.payload.issue = undefined as any
|
||||
github.context.payload.pull_request = {
|
||||
number: 10
|
||||
@@ -49,6 +49,7 @@ describe('main.ts', () => {
|
||||
describe('run()', () => {
|
||||
it('Skips invalid events', async () => {
|
||||
github.context.eventName = 'push'
|
||||
github.context.payload = {} as any
|
||||
|
||||
await main.run()
|
||||
|
||||
@@ -56,7 +57,7 @@ describe('main.ts', () => {
|
||||
})
|
||||
|
||||
it('Skips invalid actions', async () => {
|
||||
github.context.action = 'edited'
|
||||
github.context.payload.action = 'edited'
|
||||
|
||||
await main.run()
|
||||
|
||||
@@ -73,17 +74,6 @@ describe('main.ts', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('Fails if neither PR nor issue are provided', async () => {
|
||||
github.context.payload.issue = undefined as any
|
||||
github.context.payload.pull_request = undefined as any
|
||||
|
||||
await main.run()
|
||||
|
||||
expect(core.setFailed).toHaveBeenCalledWith(
|
||||
'Internal Error...No Issue or PR Provided by GitHub'
|
||||
)
|
||||
})
|
||||
|
||||
it('Fails if both PR and issue are provided', async () => {
|
||||
github.context.payload.issue = {
|
||||
number: 20
|
||||
|
||||
13
dist/index.js
generated
vendored
13
dist/index.js
generated
vendored
@@ -34825,22 +34825,19 @@ const Octokit = Octokit$1.plugin(requestLog, legacyRestEndpointMethods, paginate
|
||||
|
||||
async function run() {
|
||||
coreExports.info('Running actions/first-interaction!');
|
||||
// Check if this is an issue or PR event.
|
||||
const isIssue = githubExports.context.payload.issue !== undefined;
|
||||
const isPullRequest = githubExports.context.payload.pull_request !== undefined;
|
||||
// Skip if this is not an issue or PR event.
|
||||
if (githubExports.context.eventName !== 'issues' &&
|
||||
githubExports.context.eventName !== 'pull_request')
|
||||
if (!isIssue && !isPullRequest)
|
||||
return coreExports.info('Skipping...Not an Issue/PR Event');
|
||||
// Skip if this is not an issue/PR open event.
|
||||
if (githubExports.context.action !== 'opened')
|
||||
if (githubExports.context.payload.action !== 'opened')
|
||||
return coreExports.info('Skipping...Not an Opened Event');
|
||||
// Confirm the sender data is present.
|
||||
if (!githubExports.context.payload.sender)
|
||||
return coreExports.setFailed('Internal Error...No Sender Provided by GitHub');
|
||||
// Check if this is an issue or PR event.
|
||||
const isIssue = githubExports.context.payload.issue !== undefined;
|
||||
const isPullRequest = githubExports.context.payload.pull_request !== undefined;
|
||||
// Confirm that only one of the two is present.
|
||||
if (!isIssue && !isPullRequest)
|
||||
return coreExports.setFailed('Internal Error...No Issue or PR Provided by GitHub');
|
||||
if (isIssue && isPullRequest)
|
||||
return coreExports.setFailed('Internal Error...Both Issue and PR Provided by GitHub');
|
||||
// Get the action inputs.
|
||||
|
||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -52,8 +52,7 @@ export default [
|
||||
sourceType: 'module',
|
||||
|
||||
parserOptions: {
|
||||
project: ['tsconfig.eslint.json'],
|
||||
tsconfigRootDir: '.'
|
||||
project: ['tsconfig.eslint.json']
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
5891
package-lock.json
generated
5891
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
30
package.json
30
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "first-interaction-action",
|
||||
"description": "An action for greeting first time contributors.",
|
||||
"version": "3.0.0",
|
||||
"version": "3.1.0",
|
||||
"author": "GitHub",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
@@ -44,33 +44,33 @@
|
||||
"@octokit/rest": "^22.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/compat": "^1.3.1",
|
||||
"@github/local-action": "^5.1.0",
|
||||
"@jest/globals": "^30.0.5",
|
||||
"@octokit/types": "^14.1.0",
|
||||
"@eslint/compat": "^1.4.0",
|
||||
"@github/local-action": "^6.0.0",
|
||||
"@jest/globals": "^30.2.0",
|
||||
"@octokit/types": "^15.0.0",
|
||||
"@rollup/plugin-commonjs": "^28.0.6",
|
||||
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||
"@rollup/plugin-typescript": "^12.1.4",
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/node": "^24.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.39.0",
|
||||
"@types/jest": "^30.0.0",
|
||||
"@types/node": "^24.6.2",
|
||||
"@typescript-eslint/eslint-plugin": "^8.45.0",
|
||||
"@typescript-eslint/parser": "^8.24.1",
|
||||
"eslint": "^9.32.0",
|
||||
"eslint": "^9.36.0",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-import-resolver-typescript": "^4.4.4",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"eslint-plugin-jest": "^29.0.1",
|
||||
"eslint-plugin-prettier": "^5.5.3",
|
||||
"globals": "^16.3.0",
|
||||
"jest": "^29.7.0",
|
||||
"eslint-plugin-prettier": "^5.5.4",
|
||||
"globals": "^16.4.0",
|
||||
"jest": "^30.2.0",
|
||||
"make-coverage-badge": "^1.2.0",
|
||||
"prettier": "^3.6.2",
|
||||
"prettier-eslint": "^16.4.2",
|
||||
"rollup": "^4.46.2",
|
||||
"ts-jest": "^29.4.1",
|
||||
"rollup": "^4.52.4",
|
||||
"ts-jest": "^29.4.4",
|
||||
"ts-jest-resolver": "^2.0.1",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.9.2"
|
||||
"typescript": "^5.9.3"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@rollup/rollup-linux-x64-gnu": "*"
|
||||
|
||||
17
src/main.ts
17
src/main.ts
@@ -5,28 +5,23 @@ import { Octokit } from '@octokit/rest'
|
||||
export async function run() {
|
||||
core.info('Running actions/first-interaction!')
|
||||
|
||||
// Check if this is an issue or PR event.
|
||||
const isIssue = github.context.payload.issue !== undefined
|
||||
const isPullRequest = github.context.payload.pull_request !== undefined
|
||||
|
||||
// Skip if this is not an issue or PR event.
|
||||
if (
|
||||
github.context.eventName !== 'issues' &&
|
||||
github.context.eventName !== 'pull_request'
|
||||
)
|
||||
if (!isIssue && !isPullRequest)
|
||||
return core.info('Skipping...Not an Issue/PR Event')
|
||||
|
||||
// Skip if this is not an issue/PR open event.
|
||||
if (github.context.action !== 'opened')
|
||||
if (github.context.payload.action !== 'opened')
|
||||
return core.info('Skipping...Not an Opened Event')
|
||||
|
||||
// Confirm the sender data is present.
|
||||
if (!github.context.payload.sender)
|
||||
return core.setFailed('Internal Error...No Sender Provided by GitHub')
|
||||
|
||||
// Check if this is an issue or PR event.
|
||||
const isIssue = github.context.payload.issue !== undefined
|
||||
const isPullRequest = github.context.payload.pull_request !== undefined
|
||||
|
||||
// Confirm that only one of the two is present.
|
||||
if (!isIssue && !isPullRequest)
|
||||
return core.setFailed('Internal Error...No Issue or PR Provided by GitHub')
|
||||
if (isIssue && isPullRequest)
|
||||
return core.setFailed(
|
||||
'Internal Error...Both Issue and PR Provided by GitHub'
|
||||
|
||||
Reference in New Issue
Block a user