Skip to content

Commit 17c66ec

Browse files
authored
Merge pull request #18 from Code-Hex/fix/build
fixed Dockerfile
2 parents bc17098 + fbe2ae0 commit 17c66ec

File tree

6 files changed

+84
-2658
lines changed

6 files changed

+84
-2658
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
test:
66
runs-on: ubuntu-latest
77
steps:
8-
- uses: actions/checkout@v2
8+
- uses: actions/checkout@v4
99
- name: test
1010
uses: ./
1111
with:

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
FROM node:slim
22

3-
COPY . .
3+
WORKDIR /app
4+
5+
COPY . /app
46

57
RUN yarn install --production
68

7-
ENTRYPOINT ["node", "/lib/main.js"]
9+
ENTRYPOINT ["node", "/app/lib/main.js"]

lib/main.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
"use strict";
22
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
33
if (k2 === undefined) k2 = k;
4-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4+
var desc = Object.getOwnPropertyDescriptor(m, k);
5+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6+
desc = { enumerable: true, get: function() { return m[k]; } };
7+
}
8+
Object.defineProperty(o, k2, desc);
59
}) : (function(o, m, k, k2) {
610
if (k2 === undefined) k2 = k;
711
o[k2] = m[k];
@@ -28,18 +32,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
2832
});
2933
};
3034
Object.defineProperty(exports, "__esModule", { value: true });
31-
const core = __importStar(require("@actions/core"));
35+
const core_1 = require("@actions/core");
3236
const github = __importStar(require("@actions/github"));
3337
function run() {
3438
return __awaiter(this, void 0, void 0, function* () {
3539
try {
36-
const issueLabels = core.getInput('issue-labels');
37-
const prLabels = core.getInput('pr-labels');
40+
const issueLabels = (0, core_1.getInput)('issue-labels');
41+
const prLabels = (0, core_1.getInput)('pr-labels');
3842
if (!issueLabels && !prLabels) {
3943
throw new Error('Action must have at least one of issue-labels or pr-labels set');
4044
}
4145
// Get client and context
42-
const client = new github.GitHub(core.getInput('github-token', { required: true }));
46+
const client = new github.GitHub((0, core_1.getInput)('github-token', { required: true }));
4347
const context = github.context;
4448
if (context.payload.action !== 'opened') {
4549
console.log('No issue or PR was opened, skipping');
@@ -82,8 +86,10 @@ function run() {
8286
});
8387
}
8488
catch (error) {
85-
core.setFailed(error.message);
86-
return;
89+
if (error instanceof Error) {
90+
(0, core_1.setFailed)(error);
91+
return;
92+
}
8793
}
8894
});
8995
}
@@ -108,7 +114,7 @@ const isFirstIssue = (client, owner, repo, sender, curIssueNumber) => __awaiter(
108114
return true;
109115
});
110116
// No way to filter pulls by creator
111-
const isFirstPull = (client, owner, repo, sender, curPullNumber, page = 1) => __awaiter(void 0, void 0, void 0, function* () {
117+
const isFirstPull = (client_1, owner_1, repo_1, sender_1, curPullNumber_1, ...args_1) => __awaiter(void 0, [client_1, owner_1, repo_1, sender_1, curPullNumber_1, ...args_1], void 0, function* (client, owner, repo, sender, curPullNumber, page = 1) {
112118
// Provide console output if we loop for a while.
113119
console.log('Checking...');
114120
const { status, data: pulls } = yield client.pulls.list({

package.json

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
{
22
"name": "first-label-interaction-action",
3-
"version": "1.0.0",
3+
"version": "1.0.2",
44
"description": "An action for labeling first time contributors.",
55
"main": "lib/main.js",
66
"scripts": {
77
"build": "tsc",
8-
"format": "prettier --write **/*.ts",
9-
"test": "jest"
8+
"format": "prettier --write **/*.ts"
109
},
1110
"repository": {
1211
"type": "git",
@@ -27,20 +26,16 @@
2726
},
2827
"homepage": "https://github.com/Code-Hex/first-label-interaction#readme",
2928
"dependencies": {
30-
"@actions/core": "^1.2.6",
29+
"@actions/core": "1.9.1",
3130
"@actions/exec": "1.0.4",
3231
"@actions/github": "^2.1.1",
3332
"@actions/io": "^1.0.2",
3433
"@actions/tool-cache": "^1.3.4"
3534
},
3635
"devDependencies": {
37-
"@types/jest": "^27.4.0",
3836
"@types/node": "^12.0.4",
39-
"jest": "^27.5.0",
40-
"jest-circus": "^27.5.0",
4137
"prettier": "^1.17.1",
42-
"ts-jest": "^27.1.3",
43-
"typescript": "^4.5.5",
38+
"typescript": "^5.4.4",
4439
"yarn-audit-fix": "^9.0.10"
4540
}
4641
}

src/main.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import * as core from '@actions/core';
1+
import {getInput, setFailed} from '@actions/core';
22
import * as github from '@actions/github';
33

44
async function run() {
55
try {
6-
const issueLabels: string = core.getInput('issue-labels');
7-
const prLabels: string = core.getInput('pr-labels');
6+
const issueLabels: string = getInput('issue-labels');
7+
const prLabels: string = getInput('pr-labels');
88
if (!issueLabels && !prLabels) {
99
throw new Error(
1010
'Action must have at least one of issue-labels or pr-labels set'
1111
);
1212
}
1313
// Get client and context
1414
const client: github.GitHub = new github.GitHub(
15-
core.getInput('github-token', {required: true})
15+
getInput('github-token', {required: true})
1616
);
1717
const context = github.context;
1818

@@ -72,9 +72,11 @@ async function run() {
7272
issue_number: issue.number,
7373
labels: labels
7474
});
75-
} catch (error: any) {
76-
core.setFailed(error.message);
77-
return;
75+
} catch (error) {
76+
if (error instanceof Error) {
77+
setFailed(error);
78+
return;
79+
}
7880
}
7981
}
8082

0 commit comments

Comments
 (0)