Skip to content

Commit

Permalink
Bump more JS deps; Bump Node version
Browse files Browse the repository at this point in the history
  • Loading branch information
hennikatsoci committed Oct 20, 2023
1 parent fea427d commit d81eb00
Show file tree
Hide file tree
Showing 22 changed files with 5,279 additions and 7,159 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v2-beta
uses: actions/setup-node@v3
with:
node-version: '12'
node-version: '20'
check-latest: true
- name: Install dependencies
run: yarn
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./
with:
reportIgnoredFiles: true
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16
FROM node:20

# LABEL com.github.actions.name="ESLint Action"
# LABEL com.github.actions.description="Lint your Javascript projects with inline lint error annotations on pull requests."
Expand Down
148 changes: 74 additions & 74 deletions lib/api.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCurrentWorkflow = exports.updateCheck = exports.createCheck = exports.fetchFilesBatchCommit = exports.fetchFilesBatchPR = void 0;
const tslib_1 = require("tslib");
const core = tslib_1.__importStar(require("@actions/core"));
const constants_1 = require("./constants");
function fetchFilesBatchPR(client, prNumber, startCursor, owner = constants_1.OWNER, repo = constants_1.REPO) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCurrentWorkflow = exports.updateCheck = exports.createCheck = exports.fetchFilesBatchCommit = exports.fetchFilesBatchPR = void 0;
const tslib_1 = require("tslib");
const core = tslib_1.__importStar(require("@actions/core"));
const constants_1 = require("./constants");
function fetchFilesBatchPR(client, prNumber, startCursor, owner = constants_1.OWNER, repo = constants_1.REPO) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const { repository } = yield client.graphql(`
query ChangedFilesBatch(
$owner: String!
Expand All @@ -31,69 +31,69 @@ function fetchFilesBatchPR(client, prNumber, startCursor, owner = constants_1.OW
}
}
}
`, { owner, repo, prNumber, startCursor });
const pr = repository.pullRequest;
if (!pr || !pr.files) {
core.info(`No PR or PR files detected`);
return { files: [] };
}
core.info(`PR with files detected: ${pr.files.edges.map((e) => e.node.path)}`);
return Object.assign(Object.assign({}, pr.files.pageInfo), { files: pr.files.edges.map((e) => e.node.path) });
});
}
exports.fetchFilesBatchPR = fetchFilesBatchPR;
function fetchFilesBatchCommit(client, data, owner = constants_1.OWNER, repo = constants_1.REPO) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
try {
const resp = yield client.repos.getCommit({
owner,
repo,
ref: data.sha,
});
const filesChanged = resp.data.files.map((f) => f.filename);
core.info(`Files changed: ${filesChanged}`);
return filesChanged;
}
catch (err) {
core.error(err);
return [];
}
});
}
exports.fetchFilesBatchCommit = fetchFilesBatchCommit;
function createCheck(client, data, owner = constants_1.OWNER, repo = constants_1.REPO) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const params = {
name: constants_1.NAME,
head_sha: data.sha,
status: 'in_progress',
started_at: new Date().toISOString(),
owner,
repo,
};
const createCheckResult = yield client.checks.create(params);
data.state.checkId = createCheckResult.data.id;
return (nextParams) => updateCheck(createCheckResult, data, client, owner, repo, nextParams);
});
}
exports.createCheck = createCheck;
function updateCheck(createCheckResult, data, client, owner, repo, nextParams) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const params = Object.assign({ name: constants_1.NAME, check_run_id: createCheckResult.data.id, status: 'in_progress', owner,
repo }, nextParams);
const result = yield client.checks.update(params);
return result;
});
}
exports.updateCheck = updateCheck;
function getCurrentWorkflow(client, data, owner = constants_1.OWNER, repo = constants_1.REPO) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const workflows = yield client.actions.listRepoWorkflows({
owner,
repo,
});
const currentWorkflow = workflows.data.workflows.find((workflow) => workflow.name === data.name);
return currentWorkflow;
});
}
exports.getCurrentWorkflow = getCurrentWorkflow;
`, { owner, repo, prNumber, startCursor });
const pr = repository.pullRequest;
if (!pr || !pr.files) {
core.info(`No PR or PR files detected`);
return { files: [] };
}
core.info(`PR with files detected: ${pr.files.edges.map((e) => e.node.path)}`);
return Object.assign(Object.assign({}, pr.files.pageInfo), { files: pr.files.edges.map((e) => e.node.path) });
});
}
exports.fetchFilesBatchPR = fetchFilesBatchPR;
function fetchFilesBatchCommit(client, data, owner = constants_1.OWNER, repo = constants_1.REPO) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
try {
const resp = yield client.repos.getCommit({
owner,
repo,
ref: data.sha,
});
const filesChanged = resp.data.files.map((f) => f.filename);
core.info(`Files changed: ${filesChanged}`);
return filesChanged;
}
catch (err) {
core.error(err);
return [];
}
});
}
exports.fetchFilesBatchCommit = fetchFilesBatchCommit;
function createCheck(client, data, owner = constants_1.OWNER, repo = constants_1.REPO) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const params = {
name: constants_1.NAME,
head_sha: data.sha,
status: 'in_progress',
started_at: new Date().toISOString(),
owner,
repo,
};
const createCheckResult = yield client.checks.create(params);
data.state.checkId = createCheckResult.data.id;
return (nextParams) => updateCheck(createCheckResult, data, client, owner, repo, nextParams);
});
}
exports.createCheck = createCheck;
function updateCheck(createCheckResult, data, client, owner, repo, nextParams) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const params = Object.assign({ name: constants_1.NAME, check_run_id: createCheckResult.data.id, status: 'in_progress', owner,
repo }, nextParams);
const result = yield client.checks.update(params);
return result;
});
}
exports.updateCheck = updateCheck;
function getCurrentWorkflow(client, data, owner = constants_1.OWNER, repo = constants_1.REPO) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const workflows = yield client.actions.listRepoWorkflows({
owner,
repo,
});
const currentWorkflow = workflows.data.workflows.find((workflow) => workflow.name === data.name);
return currentWorkflow;
});
}
exports.getCurrentWorkflow = getCurrentWorkflow;
Loading

0 comments on commit d81eb00

Please sign in to comment.