Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Remove the "2 Reviews Needed" column automation from the PR board (#4657)

zackc68dcd62d24f
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index f15338703..e373d7737 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -125,7 +125,7 @@ repos:
- id: eslint
name: eslint
- files: (frontend|automations|packages/js).*?\.(js|ts|vue|json5|json)$
+ files: (frontend|automations|packages/js).*?\.(js|ts|mjs|vue|json5|json)$
"types": [file] # ESLint only accepts [javascript] by default.
language: system
pass_filenames: false
diff --git a/automations/js/prettier.config.js b/automations/js/prettier.config.js
deleted file mode 100644
index 0614ee70c..000000000
--- a/automations/js/prettier.config.js
+++ /dev/null
@@ -1,6 +0,0 @@
-module.exports = {
- trailingComma: 'es5',
- tabWidth: 2,
- semi: false,
- singleQuote: true,
-}
diff --git a/automations/js/src/count_user_reviewable_prs.js b/automations/js/src/count_user_reviewable_prs.js
index 63d71e894..0c1651474 100644
--- a/automations/js/src/count_user_reviewable_prs.js
+++ b/automations/js/src/count_user_reviewable_prs.js
@@ -13,7 +13,7 @@ module.exports = async ({ github, context, core }) => {
const slackID = JSON.parse(GH_SLACK_USERNAME_MAP)[context.actor]
if (!GITHUB_REPOSITORY || !GH_SLACK_USERNAME_MAP) {
- core.setFailed('Required dependencies were not supplied')
+ core.setFailed("Required dependencies were not supplied")
}
if (!slackID) {
@@ -44,11 +44,11 @@ query ($repoOwner: String!, $repo: String!, $cursor: String) {
}
`
const ignoredLabels = [
- 'πŸ€– aspect: text',
- '🧱 stack: documentation',
- 'πŸŸ₯ priority: critical',
+ "πŸ€– aspect: text",
+ "🧱 stack: documentation",
+ "πŸŸ₯ priority: critical",
]
- const [owner, repo] = GITHUB_REPOSITORY.split('/')
+ const [owner, repo] = GITHUB_REPOSITORY.split("/")
const isRelevantPrFromGraphql = (pr) =>
pr.author.login === context.actor &&
!pr.isDraft &&
@@ -90,8 +90,8 @@ query ($repoOwner: String!, $repo: String!, $cursor: String) {
}
core.info(`Current user has ${result.pr_count} PR(s).`)
- core.setOutput('pr_count', result.pr_count)
- core.setOutput('slack_id', result.slack_id)
+ core.setOutput("pr_count", result.pr_count)
+ core.setOutput("slack_id", result.slack_id)
} catch (error) {
core.setFailed(`Error fetching pull requests: ${error.message}`)
}
diff --git a/automations/js/src/label_pr.mjs b/automations/js/src/label_pr.mjs
index c66186ca6..13b6a3d9b 100644
--- a/automations/js/src/label_pr.mjs
+++ b/automations/js/src/label_pr.mjs
@@ -1,14 +1,14 @@
-import { readFileSync } from 'fs'
-import { PullRequest } from './utils/pr.mjs'
-import { IdSet } from './utils/id_set.mjs'
+import { readFileSync } from "fs"
+import { PullRequest } from "./utils/pr.mjs"
+import { IdSet } from "./utils/id_set.mjs"
-const exactlyOne = ['priority', 'goal']
-const atleastOne = ['aspect', 'stack']
+const exactlyOne = ["priority", "goal"]
+const atleastOne = ["aspect", "stack"]
const pathLabels = {
- migrations: 'migrations',
- project_proposal: '🧭 project: proposal',
- project_ip: '🧭 project: implementation plan',
+ migrations: "migrations",
+ project_proposal: "🧭 project: proposal",
+ project_ip: "🧭 project: implementation plan",
}
/**
@@ -20,9 +20,9 @@ const pathLabels = {
*/
function getLabelsFromChanges(allLabels, changes) {
const applicableLabels = allLabels
- .filter((label) => label.name.startsWith('🧱 stack:'))
+ .filter((label) => label.name.startsWith("🧱 stack:"))
.filter((label) => {
- const [, stackName] = label.name.split(': ')
+ const [, stackName] = label.name.split(": ")
return changes.includes(stackName)
})
Object.entries(pathLabels).forEach(([group, labelName]) => {
@@ -61,7 +61,7 @@ function getIsFullyLabeled(labels) {
* @returns {import('./utils/pr.mjs').Label[]} the label with the `id` and `name` fields
*/
async function getAllLabels(octokit, repository) {
- const [owner, repo] = repository.split('/')
+ const [owner, repo] = repository.split("/")
const res = await octokit.rest.issues.listLabelsForRepo({
owner,
repo,
@@ -82,15 +82,15 @@ async function getAllLabels(octokit, repository) {
export const main = async (octokit, core) => {
const { GITHUB_REPOSITORY } = process.env
const { eventName, eventAction, prNodeId } = JSON.parse(
- readFileSync('/tmp/event.json', 'utf-8')
+ readFileSync("/tmp/event.json", "utf-8")
)
- const changes = JSON.parse(readFileSync('/tmp/change.json', 'utf-8'))
+ const changes = JSON.parse(readFileSync("/tmp/change.json", "utf-8"))
const allLabels = await getAllLabels(octokit, GITHUB_REPOSITORY)
if (
- eventName !== 'pull_request' ||
- !['opened', 'edited'].includes(eventAction)
+ eventName !== "pull_request" ||
+ !["opened", "edited"].includes(eventAction)
) {
core.info(
`Event "${eventName}"/"${eventAction}" is not an event where a PR should be labelled.`
@@ -104,7 +104,7 @@ export const main = async (octokit, core) => {
let isTriaged = false
if (pr.labels.length) {
// If a PR already has some labels, it is considered triaged.
- core.info('The PR already has some labels.')
+ core.info("The PR already has some labels.")
isTriaged = true
}
@@ -128,7 +128,7 @@ export const main = async (octokit, core) => {
// Then we compile all the labels of all the linked issues into a pool. This
// will be used to find the labels that satisfy the requirements.
const labelPool = pr.linkedIssues.flatMap((issue) => issue.labels)
- core.debug(`Label pool: ${labelPool.map((label) => label.name).join(',')}`)
+ core.debug(`Label pool: ${labelPool.map((label) => label.name).join(",")}`)
// For each label that we only need one of, we check if the PR already has
// such a label. If not, we check if the label pool contains any valid labels
@@ -152,7 +152,7 @@ export const main = async (octokit, core) => {
core.info(
`Adding labels "${validLabels
.map((label) => label.name)
- .join(',')}" to PR.`
+ .join(",")}" to PR.`
)
validLabels.forEach((label) => {
finalLabels.add(label)
@@ -164,9 +164,9 @@ export const main = async (octokit, core) => {
if (!getIsFullyLabeled(finalLabels.items)) {
let attnLabel
if (isTriaged) {
- attnLabel = '🏷 status: label work required'
+ attnLabel = "🏷 status: label work required"
} else {
- attnLabel = '🚦 status: awaiting triage'
+ attnLabel = "🚦 status: awaiting triage"
}
core.info(`PR not fully labelled so adding "${attnLabel}".`)
attnLabel = allLabels.filter((item) => item.name === attnLabel)[0]
diff --git a/automations/js/src/last_week_tonight.mjs b/automations/js/src/last_week_tonight.mjs
index ed53034af..76265b895 100644
--- a/automations/js/src/last_week_tonight.mjs
+++ b/automations/js/src/last_week_tonight.mjs
@@ -3,14 +3,14 @@
* Openverse repos.
*/
-import { readFileSync } from 'fs'
-import { resolve } from 'path'
+import { readFileSync } from "fs"
+import { resolve } from "path"
-import yaml from 'js-yaml'
-import axios from 'axios'
-import { Octokit } from '@octokit/rest'
+import yaml from "js-yaml"
+import axios from "axios"
+import { Octokit } from "@octokit/rest"
-import { escapeHtml } from './utils/html.mjs'
+import { escapeHtml } from "./utils/html.mjs"
/* Environment variables */
@@ -34,7 +34,7 @@ if (!(pat && username && password)) process.exit(1)
/* Read GitHub information from the data files */
-const githubDataFile = resolve('../data/github.yml') // resolved from `package.json`
+const githubDataFile = resolve("../data/github.yml") // resolved from `package.json`
const githubInfo = yaml.load(readFileSync(githubDataFile))
const org = githubInfo.org
const repos = Object.values(githubInfo.repos)
@@ -43,11 +43,11 @@ const repos = Object.values(githubInfo.repos)
const msInWeeks = (weeks) => weeks * 7 * 24 * 60 * 60 * 1e3
// End date is always today
-const [endDate] = new Date().toISOString().split('T')
+const [endDate] = new Date().toISOString().split("T")
// Start date is one week before today
const [startDate] = new Date(new Date().getTime() - msInWeeks(1))
.toISOString()
- .split('T')
+ .split("T")
/* GitHub API */
@@ -60,8 +60,8 @@ const closedIssuesQ = (repo) =>
/* Other constants */
const stackNameMap = {
- api: 'API',
- mgmt: 'Management',
+ api: "API",
+ mgmt: "Management",
}
/* Format issues, PRs and repos as HTML */
@@ -82,7 +82,7 @@ const getItemsHtml = (title, items) => {
items
.flatMap((item) => item.labels) // Flatten all labels into a single array
.map((label) => label.name) // Extract the name of each label
- .filter((name) => name.startsWith('🧱 stack'))
+ .filter((name) => name.startsWith("🧱 stack"))
),
].sort()
@@ -90,7 +90,7 @@ const getItemsHtml = (title, items) => {
let itemsByStack = {}
for (const stack of stacks) {
- const stackName = stack.split(':')[1].trim()
+ const stackName = stack.split(":")[1].trim()
itemsByStack[stackName] = items
.filter((item) => item.labels.map((label) => label.name).includes(stack))
.sort((a, b) => a.number - b.number)
@@ -102,14 +102,14 @@ const getItemsHtml = (title, items) => {
...Object.entries(itemsByStack)
.map(([stackName, items]) => [
`<h4>${stackNameMap[stackName] || stackName.replace(/\b[a-z]/g, (match) => match.toUpperCase())}</h4>`,
- '<ul>',
+ "<ul>",
...items.map((item) => {
const href = item.html_url
const number = `#${item.number}`
const title = escapeHtml(item.title)
return `<li><a href="${href}">${number}</a>: ${title}`
}),
- '</ul>',
+ "</ul>",
])
.flat(),
]
@@ -126,8 +126,8 @@ const getItemsHtml = (title, items) => {
const getRepoHtml = ({ repo, mergedPrs, closedIssues }) => {
return [
`<h2><a href="https://github.com/${org}/${repo}">${repo}</a></h2>`,
- ...getItemsHtml('Merged PRs', mergedPrs),
- ...getItemsHtml('Closed issues', closedIssues),
+ ...getItemsHtml("Merged PRs", mergedPrs),
+ ...getItemsHtml("Closed issues", closedIssues),
]
}
@@ -143,19 +143,19 @@ const getRepoHtml = ({ repo, mergedPrs, closedIssues }) => {
* @returns {Promise} - the response for the POST request
*/
const postActivities = (activities) => {
- const report = activities.map(getRepoHtml).flat().join('\n')
+ const report = activities.map(getRepoHtml).flat().join("\n")
- const MAKE_SITE_API = 'https://make.wordpress.org/openverse/wp-json/wp/v2/'
- const token = Buffer.from(`${username}:${password}`).toString('base64')
+ const MAKE_SITE_API = "https://make.wordpress.org/openverse/wp-json/wp/v2/"
+ const token = Buffer.from(`${username}:${password}`).toString("base64")
return axios.post(
- 'posts',
+ "posts",
{
title: `A week in Openverse: ${startDate} - ${endDate}`,
slug: `last-week-openverse-${startDate}-${endDate}`,
excerpt: `The developments in Openverse between ${startDate} and ${endDate}`,
content: report,
- status: 'publish',
+ status: "publish",
tags: [
3, // openverse
5, // week-in-openverse
@@ -185,7 +185,7 @@ for (const repo of repos) {
const res = await postActivities(reportData)
if (res.status !== 201) {
- console.error('Create post request failed. See the logs.')
+ console.error("Create post request failed. See the logs.")
process.exitCode = 1
}
console.log(JSON.stringify(res.data, null, 2))
diff --git a/automations/js/src/project_automation/issues.mjs b/automations/js/src/project_automation/issues.mjs
index c38b8ea34..60f2a509d 100644
--- a/automations/js/src/project_automation/issues.mjs
+++ b/automations/js/src/project_automation/issues.mjs
@@ -1,4 +1,4 @@
-import { getBoard } from '../utils/projects.mjs'
+import { getBoard } from "../utils/projects.mjs"
/**
* Set the "Priority" custom field based on the issue's labels. Also move
@@ -13,14 +13,14 @@ async function syncPriority(core, issue, backlogBoard, issueCard) {
core.info(`Syncing priority for issue "${issue.number}".`)
const priority = issue.labels.find((label) =>
- label.name.includes('priority')
+ label.name.includes("priority")
)?.name
core.debug(`Priority: ${priority}`)
if (priority) {
- await backlogBoard.setCustomChoiceField(issueCard.id, 'Priority', priority)
+ await backlogBoard.setCustomChoiceField(issueCard.id, "Priority", priority)
}
- if (priority === 'πŸŸ₯ priority: critical') {
+ if (priority === "πŸŸ₯ priority: critical") {
core.info('Moving critical issue to "πŸ“… To Do" column.')
await backlogBoard.moveCard(issueCard.id, backlogBoard.columns.ToDo)
}
@@ -34,7 +34,7 @@ async function syncPriority(core, issue, backlogBoard, issueCard) {
* @param context {import('@actions/github').context} info about the current event
*/
export const main = async (octokit, core, context) => {
- core.info('Starting script `issues.mjs`.')
+ core.info("Starting script `issues.mjs`.")
const { EVENT_ACTION: eventAction } = process.env
core.debug(`Event action: ${eventAction}`)
@@ -43,24 +43,24 @@ export const main = async (octokit, core, context) => {
core.debug(`Issue node ID: ${issue.node_id}`)
const label = context.payload.label
- core.info('Issue details:', issue)
+ core.info("Issue details:", issue)
- if (issue.labels.some((label) => label.name === '🧭 project: thread')) {
- core.warning('Issue is a project thread. Exiting.')
+ if (issue.labels.some((label) => label.name === "🧭 project: thread")) {
+ core.warning("Issue is a project thread. Exiting.")
return
}
- const backlogBoard = await getBoard(octokit, core, 'Backlog')
+ const backlogBoard = await getBoard(octokit, core, "Backlog")
// Create new, or get the existing, card for the current issue.
const card = await backlogBoard.addCard(issue.node_id)
core.debug(`Issue card ID: ${card.id}`)
switch (eventAction) {
- case 'opened':
- case 'reopened': {
- if (issue.labels.some((label) => label.name === 'β›” status: blocked')) {
- core.info('Issue was opened, labelled as blocked.')
+ case "opened":
+ case "reopened": {
+ if (issue.labels.some((label) => label.name === "β›” status: blocked")) {
+ core.info("Issue was opened, labelled as blocked.")
await backlogBoard.moveCard(card.id, backlogBoard.columns.Blocked)
} else {
await backlogBoard.moveCard(card.id, backlogBoard.columns.Backlog)
@@ -69,36 +69,36 @@ export const main = async (octokit, core, context) => {
break
}
- case 'closed': {
- if (issue.state_reason === 'completed') {
- core.info('Issue was closed as completed.')
+ case "closed": {
+ if (issue.state_reason === "completed") {
+ core.info("Issue was closed as completed.")
await backlogBoard.moveCard(card.id, backlogBoard.columns.Done)
} else {
- core.info('Issue was closed as discarded.')
+ core.info("Issue was closed as discarded.")
await backlogBoard.moveCard(card.id, backlogBoard.columns.Discarded)
}
break
}
- case 'assigned': {
+ case "assigned": {
if (card.status === backlogBoard.columns.Backlog) {
await backlogBoard.moveCard(card.id, backlogBoard.columns.ToDo)
}
break
}
- case 'labeled': {
- if (label.name === 'β›” status: blocked') {
- core.info('Issue was labeled as blocked.')
+ case "labeled": {
+ if (label.name === "β›” status: blocked") {
+ core.info("Issue was labeled as blocked.")
await backlogBoard.moveCard(card.id, backlogBoard.columns.Blocked)
}
await syncPriority(core, issue, backlogBoard, card)
break
}
- case 'unlabeled': {
- if (label.name === 'β›” status: blocked') {
- core.info('Issue was unlabeled as blocked.')
+ case "unlabeled": {
+ if (label.name === "β›” status: blocked") {
+ core.info("Issue was unlabeled as blocked.")
await backlogBoard.moveCard(card.id, backlogBoard.columns.Backlog)
}
await syncPriority(core, issue, backlogBoard, card)
diff --git a/automations/js/src/project_automation/prs.mjs b/automations/js/src/project_automation/prs.mjs
index 975b53eca..ade8aae0d 100644
--- a/automations/js/src/project_automation/prs.mjs
+++ b/automations/js/src/project_automation/prs.mjs
@@ -1,7 +1,7 @@
-import { readFileSync } from 'fs'
+import { readFileSync } from "fs"
-import { getBoard } from '../utils/projects.mjs'
-import { PullRequest } from '../utils/pr.mjs'
+import { getBoard } from "../utils/projects.mjs"
+import { PullRequest } from "../utils/pr.mjs"
/**
* Move the PR to the right column based on the number of reviews.
@@ -19,17 +19,14 @@ async function syncReviews(core, pr, prBoard, prCard) {
core.debug(`PR review counts: ${reviewCounts}`)
core.debug(`PR reviews decision: ${reviewDecision}`)
- if (reviewDecision === 'APPROVED') {
- core.info('Moving PR on the basis of review decision.')
+ if (reviewDecision === "APPROVED") {
+ core.info("Moving PR on the basis of review decision.")
await prBoard.moveCard(prCard.id, prBoard.columns.Approved)
- } else if (reviewDecision === 'CHANGES_REQUESTED') {
- core.info('Moving PR on the basis of review decision.')
+ } else if (reviewDecision === "CHANGES_REQUESTED") {
+ core.info("Moving PR on the basis of review decision.")
await prBoard.moveCard(prCard.id, prBoard.columns.ChangesRequested)
- } else if (reviewCounts.APPROVED === 1) {
- core.info('Moving PR on the basis of 1 approval.')
- await prBoard.moveCard(prCard.id, prBoard.columns.Needs1Review)
} else {
- await prBoard.moveCard(prCard.id, prBoard.columns.Needs2Reviews)
+ await prBoard.moveCard(prCard.id, prBoard.columns.NeedsReview)
}
}
@@ -62,10 +59,10 @@ async function syncIssues(core, pr, backlogBoard, destColumn) {
* @param core {import('@actions/core')} GitHub Actions toolkit, for logging
*/
export const main = async (octokit, core) => {
- core.info('Starting script `prs.mjs`.')
+ core.info("Starting script `prs.mjs`.")
const { eventName, eventAction, prNodeId } = JSON.parse(
- readFileSync('/tmp/event.json', 'utf-8')
+ readFileSync("/tmp/event.json", "utf-8")
)
core.debug(`Event name: ${eventName}`)
core.debug(`Event action: ${eventAction}`)
@@ -74,14 +71,14 @@ export const main = async (octokit, core) => {
const pr = new PullRequest(octokit, core, prNodeId)
await pr.init()
- const prBoard = await getBoard(octokit, core, 'PRs')
- const backlogBoard = await getBoard(octokit, core, 'Backlog')
+ const prBoard = await getBoard(octokit, core, "PRs")
+ const backlogBoard = await getBoard(octokit, core, "Backlog")
// Create new, or get the existing, card for the current pull request.
const prCard = await prBoard.addCard(pr.nodeId)
core.debug(`PR card ID: ${prCard.id}`)
- if (eventName === 'pull_request_review') {
+ if (eventName === "pull_request_review") {
if (pr.isDraft) {
await prBoard.moveCard(prCard.id, prBoard.columns.Draft)
} else if (!pr.isMerged) {
@@ -95,38 +92,38 @@ export const main = async (octokit, core) => {
}
} else {
switch (eventAction) {
- case 'opened':
- case 'reopened': {
+ case "opened":
+ case "reopened": {
if (pr.isDraft) {
- core.info('PR is a draft.')
+ core.info("PR is a draft.")
await prBoard.moveCard(prCard.id, prBoard.columns.Draft)
} else {
- core.info('PR is ready for review.')
+ core.info("PR is ready for review.")
await syncReviews(core, pr, prBoard, prCard)
}
- await syncIssues(core, pr, backlogBoard, 'InProgress')
+ await syncIssues(core, pr, backlogBoard, "InProgress")
break
}
- case 'edited': {
- await syncIssues(core, pr, backlogBoard, 'InProgress')
+ case "edited": {
+ await syncIssues(core, pr, backlogBoard, "InProgress")
break
}
- case 'converted_to_draft': {
+ case "converted_to_draft": {
await prBoard.moveCard(prCard.id, prBoard.columns.Draft)
break
}
- case 'ready_for_review': {
+ case "ready_for_review": {
await syncReviews(core, pr, prBoard, prCard)
break
}
- case 'closed': {
+ case "closed": {
if (!pr.isMerged) {
- core.info('PR was closed without merge.')
- await syncIssues(core, pr, backlogBoard, 'Backlog')
+ core.info("PR was closed without merge.")
+ await syncIssues(core, pr, backlogBoard, "Backlog")
}
break
}
diff --git a/automations/js/src/project_thread_updates.js b/automations/js/src/project_thread_updates.js
index 19ab0359a..e8fc2866d 100644
--- a/automations/js/src/project_thread_updates.js
+++ b/automations/js/src/project_thread_updates.js
@@ -4,10 +4,10 @@
const DAYS_UPDATED_WITHIN = 14
const activeDevelopmentStatuses = [
- 'πŸš€ In Kickoff',
- 'πŸ’¬ In RFC',
- '🚧 In Progress',
- '🚒 Shipped',
+ "πŸš€ In Kickoff",
+ "πŸ’¬ In RFC",
+ "🚧 In Progress",
+ "🚒 Shipped",
]
const GET_PROJECT_CARDS = `
@@ -62,7 +62,7 @@ const GET_PROJECT_CARDS = `
*/
module.exports = async ({ github, core }) => {
try {
- const isDryRun = process.env.DRY_RUN === 'true' ?? false
+ const isDryRun = process.env.DRY_RUN === "true" ?? false
const currentDate = new Date()
// Create a date by subtracting DAYS_UPDATED_WITHIN days
@@ -74,17 +74,17 @@ module.exports = async ({ github, core }) => {
// Fetch project cards with their associated issue data
const result = await github.graphql(GET_PROJECT_CARDS, {
projectBoardID: 70,
- projectStatusColumnName: 'Status',
- repoOwner: 'wordpress',
- repo: 'openverse',
+ projectStatusColumnName: "Status",
+ repoOwner: "wordpress",
+ repo: "openverse",
})
for (const node of result.repository.projectV2.items.nodes) {
const issue = node.content
// If we're not looking at an open issue older than the required update date, move along
if (
- issue.__typename !== 'Issue' ||
- issue.state !== 'OPEN' ||
+ issue.__typename !== "Issue" ||
+ issue.state !== "OPEN" ||
new Date(issue.createdAt) > requiredUpdatedByDate
) {
continue
@@ -115,7 +115,7 @@ module.exports = async ({ github, core }) => {
core.info(`Would have commented on issue ${issue.url}: ${body}`)
} else {
// Extract the owner, repo, and issue number from the issue URL
- const [, , , owner, repo, , issue_number] = issue.url.split('/')
+ const [, , , owner, repo, , issue_number] = issue.url.split("/")
await github.rest.issues.createComment({
owner,
diff --git a/automations/js/src/render-jinja.js b/automations/js/src/render-jinja.js
index 23bd2f38c..c7173fe59 100644
--- a/automations/js/src/render-jinja.js
+++ b/automations/js/src/render-jinja.js
@@ -1,9 +1,9 @@
-const fs = require('fs')
-const path = require('path')
+const fs = require("fs")
+const path = require("path")
-const nunjucks = require('nunjucks')
+const nunjucks = require("nunjucks")
-const rootDir = path.join(__dirname, '..', '..', '..')
+const rootDir = path.join(__dirname, "..", "..", "..")
nunjucks.configure(rootDir, {
trimBlocks: true,
lstripBlocks: true,
diff --git a/automations/js/src/sync_labels.mjs b/automations/js/src/sync_labels.mjs
index c04bbbe15..a47d7d0d4 100644
--- a/automations/js/src/sync_labels.mjs
+++ b/automations/js/src/sync_labels.mjs
@@ -4,13 +4,13 @@
*/
const infraRepo = {
- owner: 'WordPress',
- repo: 'openverse-infrastructure',
+ owner: "WordPress",
+ repo: "openverse-infrastructure",
}
const monoRepo = {
- owner: 'WordPress',
- repo: 'openverse',
+ owner: "WordPress",
+ repo: "openverse",
}
const exclusions = [/^design:/, /^migrations$/]
@@ -24,10 +24,10 @@ const exclusions = [/^design:/, /^migrations$/]
const cmpLabels = (a, b) => {
const differences = []
if (a.description !== b.description) {
- differences.push('description')
+ differences.push("description")
}
if (a.color !== b.color) {
- differences.push('color')
+ differences.push("color")
}
return differences
}
@@ -85,7 +85,7 @@ export const main = async (octokit, core) => {
if (infraLabel) {
const diff = cmpLabels(label, infraLabel)
if (diff.length) {
- const diffs = diff.join(', ')
+ const diffs = diff.join(", ")
core.info(`Label "${label.name}" differs in ${diffs}. Updating.`)
await octokit.rest.issues.updateLabel(newLabel)
}
diff --git a/automations/js/src/utils/html.mjs b/automations/js/src/utils/html.mjs
index 816602846..e54064e7a 100644
--- a/automations/js/src/utils/html.mjs
+++ b/automations/js/src/utils/html.mjs
@@ -7,11 +7,11 @@
*/
export const escapeHtml = (text) => {
const charHtmlMap = {
- "'": '&apos;',
- '"': '&quot;',
- '<': '&lt;',
- '>': '&gt;',
- '&': '&amp;',
+ "'": "&apos;",
+ '"': "&quot;",
+ "<": "&lt;",
+ ">": "&gt;",
+ "&": "&amp;",
}
return text.replace(/[&"'<>]/g, (c) => charHtmlMap[c])
}
diff --git a/automations/js/src/utils/projects.mjs b/automations/js/src/utils/projects.mjs
index af00e1631..dc797f658 100644
--- a/automations/js/src/utils/projects.mjs
+++ b/automations/js/src/utils/projects.mjs
@@ -14,7 +14,7 @@ const PROJECT_NUMBERS = {
PRs: 98,
Todos: 59,
Discussions: 79,
- 'Project Tracker': 70,
+ "Project Tracker": 70,
}
class Project {
@@ -55,8 +55,8 @@ class Project {
*/
getColumns() {
return Object.fromEntries(
- Object.keys(this.fields['Status'].options).map((key) => [
- key.replace(/\W/g, '').replace(/^\d*/, '').trim(),
+ Object.keys(this.fields["Status"].options).map((key) => [
+ key.replace(/\W/g, "").replace(/^\d*/, "").trim(),
key,
])
)
@@ -202,7 +202,7 @@ class Project {
optionId: this.fields[fieldName].options[optionName],
}
)
- this.core.debug('setCustomChoiceField response:', JSON.stringify(res))
+ this.core.debug("setCustomChoiceField response:", JSON.stringify(res))
return res.updateProjectV2ItemFieldValue.projectV2Item.id
}
@@ -216,7 +216,7 @@ class Project {
*/
async moveCard(cardId, destColumn) {
this.core.info(`Moving card "${cardId}" to column "${destColumn}".`)
- return await this.setCustomChoiceField(cardId, 'Status', destColumn)
+ return await this.setCustomChoiceField(cardId, "Status", destColumn)
}
}
@@ -234,7 +234,7 @@ export async function getBoard(octokit, core, name) {
throw new Error(`Unknown project board "${name}".`)
}
- const project = new Project(octokit, core, 'WordPress', projectNumber)
+ const project = new Project(octokit, core, "WordPress", projectNumber)
await project.init()
return project
}