Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into v3
Browse files Browse the repository at this point in the history
  • Loading branch information
8398a7 committed Sep 24, 2022
2 parents 2204883 + e59743d commit e0e369e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 17 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "action-slack",
"version": "3.13.2",
"version": "3.14.0",
"description": "You can notify slack of GitHub Actions.",
"main": "lib/main.js",
"scripts": {
Expand Down
42 changes: 28 additions & 14 deletions src/fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,21 @@ export class FieldFactory {
}

private async took(): Promise<string> {
const resp = await this.octokit?.rest.actions.listJobsForWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.runId,
});
const currentJob = resp?.data.jobs.find(job =>
this.isCurrentJobName(job.name),
const jobs = await this.octokit?.paginate(
this.octokit?.rest.actions.listJobsForWorkflowRun,
{
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.runId,
},
(response, done) => {
if (response.data.find(job => this.isCurrentJobName(job.name))) {
done();
}
return response.data;
},
);
const currentJob = jobs.find(job => this.isCurrentJobName(job.name));
if (currentJob === undefined) {
process.env.AS_TOOK = this.jobIsNotFound;
return this.jobIsNotFound;
Expand Down Expand Up @@ -140,14 +147,21 @@ export class FieldFactory {

private async job(): Promise<string> {
const { owner } = context.repo;
const resp = await this.octokit?.rest.actions.listJobsForWorkflowRun({
owner,
repo: context.repo.repo,
run_id: context.runId,
});
const currentJob = resp?.data.jobs.find(job =>
this.isCurrentJobName(job.name),
const jobs = await this.octokit?.paginate(
this.octokit?.rest.actions.listJobsForWorkflowRun,
{
owner,
repo: context.repo.repo,
run_id: context.runId,
},
(response, done) => {
if (response.data.find(job => this.isCurrentJobName(job.name))) {
done();
}
return response.data;
},
);
const currentJob = jobs.find(job => this.isCurrentJobName(job.name));
if (currentJob === undefined) {
process.env.AS_JOB = this.jobIsNotFound;
return this.jobIsNotFound;
Expand Down

0 comments on commit e0e369e

Please sign in to comment.