Skip to content

Commit

Permalink
fix: broken @actions/github
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickHeneise committed Aug 11, 2021
1 parent 07c49b2 commit 026d823
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 97 deletions.
4 changes: 2 additions & 2 deletions dist/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18024,7 +18024,7 @@ var __webpack_exports__ = {}
const excludes = core.getInput('excludes')

const octokit = github.getOctokit(process.env.GITHUB_TOKEN)
const { data: list } = await octokit.pulls.listFiles({
const { data: list } = await octokit.rest.pulls.listFiles({
...context.repo,
pull_number: pullNumber
})
Expand Down Expand Up @@ -18072,7 +18072,7 @@ var __webpack_exports__ = {}
hasErrors = results.filter((r) => r.errors && r.errors.length > 0)
const message = comment(results)
if (message && message.length > 0) {
await octokit.issues.createComment({
await octokit.rest.issues.createComment({
...context.repo,
issue_number: context.payload.number,
body: `SEO Check: \n\n${message}`
Expand Down
2 changes: 1 addition & 1 deletion dist/index.mjs.map

Large diffs are not rendered by default.

84 changes: 16 additions & 68 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
Expand Up @@ -23,6 +23,7 @@
],
"main": "dist/index.js",
"scripts": {
"start": "node -r dotenv/config src/index.mjs",
"build": "npm run lint && npm run test && npm run prepare",
"postinstall": "husky install",
"lint": "eslint .",
Expand All @@ -47,7 +48,6 @@
"dependencies": {
"@actions/core": "^1.4.0",
"@actions/github": "^5.0.0",
"@octokit/action": "^3.12.0",
"glob-to-regexp": "^0.4.1",
"gray-matter": "^4.0.3",
"node-fetch": "^2.6.1",
Expand Down
2 changes: 1 addition & 1 deletion src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async function run() {
hasErrors = results.filter((r) => r.errors && r.errors.length > 0)
const message = comment(results)
if (message && message.length > 0) {
await octokit.issues.createComment({
await octokit.rest.issues.createComment({
...context.repo,
issue_number: context.payload.number,
body: `SEO Check: \n\n${message}`
Expand Down
2 changes: 1 addition & 1 deletion src/listFiles.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default async function files() {
const excludes = core.getInput('excludes')

const octokit = github.getOctokit(process.env.GITHUB_TOKEN)
const { data: list } = await octokit.pulls.listFiles({
const { data: list } = await octokit.rest.pulls.listFiles({
...context.repo,
pull_number: pullNumber
})
Expand Down
48 changes: 25 additions & 23 deletions test/listFiles.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,31 @@ jest.mock('@actions/github', () => {
},
getOctokit: jest.fn().mockImplementation(() => {
return {
pulls: {
listFiles: jest.fn().mockImplementation(() => {
return {
data: [
{
filename: '/exclude/index.md',
raw_url: 'https://github.com/test/test/raw/123/exclude.md'
},
{
filename: 'test.md',
raw_url: 'https://github.com/test/test/raw/123/test.md'
},
{
filename: '/include/index.mdx',
raw_url: 'https://github.com/test/test/raw/123/index.mdx'
},
{
filename: '/include/blog.md',
raw_url: 'https://github.com/test/test/raw/123/blog.md'
}
]
}
})
rest: {
pulls: {
listFiles: jest.fn().mockImplementation(() => {
return {
data: [
{
filename: '/exclude/index.md',
raw_url: 'https://github.com/test/test/raw/123/exclude.md'
},
{
filename: 'test.md',
raw_url: 'https://github.com/test/test/raw/123/test.md'
},
{
filename: '/include/index.mdx',
raw_url: 'https://github.com/test/test/raw/123/index.mdx'
},
{
filename: '/include/blog.md',
raw_url: 'https://github.com/test/test/raw/123/blog.md'
}
]
}
})
}
}
}
})
Expand Down

0 comments on commit 026d823

Please sign in to comment.