Skip to content

Commit

Permalink
github actions: switch embedded JS to ESM (graphql#3612)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov authored May 28, 2022
1 parent 4970a92 commit dbf142f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cmd-publish-pr-on-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ jobs:
uses: actions/github-script@v5
with:
script: |
const fs = require('fs');
const assert = require('assert');
import fs from 'node:fs';
import assert from 'node:assert';
const pull_request = JSON.parse(process.env.PULL_REQUEST_JSON);
const packageJSONPath = './npmDist/package.json';
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cmd-run-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
uses: actions/github-script@v5
with:
script: |
const fs = require('fs');
import fs from 'node:fs';
// GH doesn't expose job's id so we need to get it through API, see
// https://github.community/t/job-id-is-string-in-github-job-but-integer-in-actions-api/139060
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/github-actions-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ jobs:
uses: actions/github-script@v5
with:
script: |
const fs = require('fs');
import fs from 'node:fs';
const event = JSON.parse(fs.readFileSync('./event.json', 'utf8'));
github.rest.issues.createComment({
await github.rest.issues.createComment({
...context.repo,
issue_number: event.pull_request.number,
body:
Expand All @@ -61,7 +61,7 @@ jobs:
- uses: actions/github-script@v5
with:
script: |
github.rest.reactions.createForIssueComment({
await github.rest.reactions.createForIssueComment({
...context.repo,
comment_id: context.payload.comment.id,
content: 'eyes',
Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
uses: actions/github-script@v5
with:
script: |
const fs = require('fs');
import fs from 'node:fs';
const needs = JSON.parse(process.env.NEEDS);
Expand All @@ -134,7 +134,7 @@ jobs:
uses: actions/github-script@v5
with:
script: |
const fs = require('fs');
import fs from 'node:fs';
const replyMessage = fs.readFileSync('./replyMessage.txt', 'utf-8');
const { issue, comment, sender } = context.payload;
Expand All @@ -144,14 +144,14 @@ jobs:
.map((line) => '> ' + line)
.join('\n');
github.rest.issues.createComment({
await github.rest.issues.createComment({
...context.repo,
issue_number: issue.number,
body: quoteRequest + `\n\n@${sender.login} ` + replyMessage,
});
// `github.rest` doesn't have this method :( so use graphql instead
github.graphql(`
await github.graphql(`
mutation ($subjectId: ID!) {
minimizeComment(input: { subjectId: $subjectId, classifier: RESOLVED})
{ __typename }
Expand Down

0 comments on commit dbf142f

Please sign in to comment.