Skip to content

Commit

Permalink
Use .rest in Octokit calls (#3506)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvkb authored Dec 11, 2023
1 parent 228d63e commit 8b0ec49
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion automations/js/src/label_pr.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function getIsFullyLabeled(labels) {
*/
async function getLabel(octokit, repository, name) {
const [owner, repo] = repository.split('/')
const res = await octokit.issues.getLabel({ owner, repo, name })
const res = await octokit.rest.issues.getLabel({ owner, repo, name })
return {
id: res.data.node_id,
name,
Expand Down
8 changes: 4 additions & 4 deletions automations/js/src/sync_labels.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ export const main = async (octokit, core) => {
// We assume that both repos have < 100 labels and do not paginate.

/** @type {Label[]} */
const { data: monoLabels } = await octokit.issues.listLabelsForRepo({
const { data: monoLabels } = await octokit.rest.issues.listLabelsForRepo({
...monoRepo,
per_page: 100,
})

core.info(`Found ${monoLabels.length} labels in the monorepo.`)

/** @type {Label[]} */
const { data: infraLabels } = await octokit.issues.listLabelsForRepo({
const { data: infraLabels } = await octokit.rest.issues.listLabelsForRepo({
...infraRepo,
per_page: 100,
})
Expand Down Expand Up @@ -87,11 +87,11 @@ export const main = async (octokit, core) => {
if (diff.length) {
const diffs = diff.join(', ')
core.info(`Label "${label.name}" differs in ${diffs}. Updating.`)
await octokit.issues.updateLabel(newLabel)
await octokit.rest.issues.updateLabel(newLabel)
}
} else {
core.info(`Label "${label.name}" does not exist. Creating.`)
await octokit.issues.createLabel(newLabel)
await octokit.rest.issues.createLabel(newLabel)
}
}
}

0 comments on commit 8b0ec49

Please sign in to comment.