Skip to content

Commit

Permalink
fix: add more octokit debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
prototypicalpro committed Dec 10, 2020
1 parent 2e58f1c commit 0c8803b
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 62 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[![GitHub Marketplace version](https://img.shields.io/github/release/newrelic/repolinter-action.svg?label=Marketplace&logo=github)](https://github.com/marketplace/actions/repolinter-action) ![CI](https://github.com/newrelic/repolinter-action/workflows/CI/badge.svg?event=push) [![codecov](https://codecov.io/gh/newrelic/repolinter-action/branch/main/graph/badge.svg?token=EWYZ7C6RSL)](https://codecov.io/gh/newrelic/repolinter-action) [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/newrelic/repolinter-action.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/newrelic/repolinter-action/context:javascript)

This action runs [Repolinter](https://github.com/todogroup/repolinter) on your repository. Optionally you can also configure this tool to create GitHub issues with the Repolinter output.
This action runs [Repolinter](https://github.com/todogroup/repolinter) on your repository. Repolinter's optional external dependencies (licensee, linguist, github-markup) are installed using a docker build step. Optionally you can also configure this tool to create GitHub issues with the Repolinter output.

Currently this action uses the [newrelic-forks/repolinter](https://github.com/newrelic-forks/repolinter) fork, which includes a number of changes needed for issue creation support. A [PR](https://github.com/todogroup/repolinter/pull/174) to merge this fork into Repolinter is underway.

Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

19 changes: 6 additions & 13 deletions src/createorUpdateIssue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ type Octo = InstanceType<typeof Octokit>
* user this action is impersonating (usually github-actions-bot), and that the
* issue has not been updated by an action run number greater than the current one.
*
* Note: options.labelName should be a label that is unique to the repolinter
* action, otherwise there is a small chance this function may attempt to edit
* other people's issues.
*
* @param options.owner The owner of the repository to create an issue on
* @param options.repo The repository to create the issue on
* @param options.username The username associated with the octokit instance
Expand All @@ -49,17 +53,6 @@ type Octo = InstanceType<typeof Octokit>
* @param options.forceCreateIssue Set to truthy to always create a new issue,
* instead of editing the old one. The old issue will automatically be
* closed if found.
* @note options.labelName should be a label that is unique to the
* repolinter
*
*
*
* action, otherwise there is a small chance this
* function may
* attempt
* to
*
* edit other people's issues.
* @returns The issue number of the created issue, or null if no issue was created.
*/
export default async function createOrUpdateIssue(
Expand Down Expand Up @@ -141,8 +134,8 @@ export interface FindRepolinterIssueOpts {
* issue that was created soonest will be returned.
*
* This function uses the GitHub REST API to perform a search that can be
* described with the following search query: ``` type:issue repo:<the current
* repo> creator:<username> label:<label-name> sort:author-date-desc\ ```
* described with the following search query: `type:issue repo:<the current
* repo> creator:<username> label:<label-name> sort:author-date-desc\`
*
* @param client The authenticated octokit client to use
* @param options.owner The owner of the repository to search
Expand Down
15 changes: 2 additions & 13 deletions src/entry.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
import run from './main'

/**
* @file This file serves as the "entry"
* you can check out main.ts for
*
*
* the
*
*
*
*
*
*
* actual
* "main" function.
* @file This file serves as the "entry" you can check out main.ts for the
* actual "main" function.
*/

run()
34 changes: 3 additions & 31 deletions src/getOctokit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,9 @@ import {Octokit as ActionKit} from '@octokit/action'
import {retry} from '@octokit/plugin-retry'

/**
* @file This file serves as a centralized
* location to setup Octokit with
*
*
*
*
*
* the
*
*
*
* appropriate
* plugins and authentication. All
* Octokit
*
*
*
*
* instances
* in
*
* this
*
* action should come
* from this
* file
*
*
*
* to
* prevent type conflicts.
* @file This file serves as a centralized location to setup Octokit with the
* appropriate plugins and authentication. All Octokit instances in this
* action should come from this file to prevent type conflicts.
*/

// strip plugin types to make testing easier
Expand Down
6 changes: 4 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,10 @@ export default async function run(disableRetry?: boolean): Promise<void> {
error: core.error
}
})
octokit.hook.before('request', options =>
core.debug(`${options.method} ${options.url}`)
octokit.hook.after('request', (response, options) =>
core.debug(
`${options.method} ${options.url}: ${JSON.stringify(response)}`
)
)

const [owner, repo] = REPO.split('/')
Expand Down

0 comments on commit 0c8803b

Please sign in to comment.