Compare commits
25 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 |
@@ -32,7 +32,7 @@ jobs:
|
||||
|
||||
- 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
|
||||
|
||||
@@ -22,7 +22,7 @@ jobs:
|
||||
|
||||
- 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
|
||||
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
|
||||
- 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
|
||||
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
|
||||
- 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,8 @@ 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
|
||||
|
||||
@@ -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'
|
||||
|
||||
+3
-13
@@ -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
|
||||
|
||||
+5
-8
@@ -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.
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Generated
+1279
-969
File diff suppressed because it is too large
Load Diff
+13
-13
@@ -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.2",
|
||||
"@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": "^30.0.0",
|
||||
"@types/node": "^24.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.41.0",
|
||||
"@types/node": "^24.6.2",
|
||||
"@typescript-eslint/eslint-plugin": "^8.45.0",
|
||||
"@typescript-eslint/parser": "^8.24.1",
|
||||
"eslint": "^9.34.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.4",
|
||||
"globals": "^16.3.0",
|
||||
"jest": "^30.0.5",
|
||||
"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.48.1",
|
||||
"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": "*"
|
||||
|
||||
+6
-11
@@ -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