Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: linting #5

Merged
merged 1 commit into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19905,7 +19905,7 @@ const generateScores = async ({ scope, database: currentDatabase, maxRequestInPa

for (let index = 0; index < chunks.length; index++) {
const chunk = chunks[index]
core.debug(`Processing chunk ${index+1}/${chunks.length}`)
core.debug(`Processing chunk ${index + 1}/${chunks.length}`)

const chunkScores = await Promise.all(chunk.map(async ({ org, repo }) => {
const { score, date } = await getProjectScore({ platform, org, repo })
Expand Down Expand Up @@ -19935,7 +19935,7 @@ const generateScores = async ({ scope, database: currentDatabase, maxRequestInPa
scores.push(...chunkScores)
}

core.debug(`All the scores are already collected`)
core.debug('All the scores are already collected')

const reportContent = await generateReportContent(scores)
const issueContent = await generateIssueContent(scores)
Expand Down Expand Up @@ -20307,25 +20307,25 @@ async function run () {
octokit = github.getOctokit(githubToken)
}

core.info("Checking Scope...")
core.info('Checking Scope...')
const scope = await readFile(scopePath, 'utf8').then(content => JSON.parse(content))
let database = {}

// Check if database exists
try {
core.info("Checking if database exists...")
core.info('Checking if database exists...')
await stat(databasePath)
database = await readFile(databasePath, 'utf8').then(content => JSON.parse(content))
} catch (error) {
core.info('Database does not exist, creating new database')
}

// PROCESS
core.info("Generating scores...")
core.info('Generating scores...')
const { reportContent, issueContent, database: newDatabaseState } = await generateScores({ scope, database, maxRequestInParallel })

// @TODO: If no changes to database, skip the rest of the process
core.info("Checking database changes...")
core.info('Checking database changes...')
const hasChanges = isDifferentContent(database, newDatabaseState)

if (!hasChanges) {
Expand All @@ -20334,14 +20334,14 @@ async function run () {
}

// Save changes
core.info("Saving changes to database and report")
core.info('Saving changes to database and report')
await writeFile(databasePath, JSON.stringify(newDatabaseState, null, 2))
await writeFile(reportPath, reportContent)

// Commit changes
// @see: https://github.com/actions/checkout#push-a-commit-using-the-built-in-token
if (autoCommit) {
core.info("Committing changes to database and report")
core.info('Committing changes to database and report')
await exec.exec('git config user.name github-actions')
await exec.exec('git config user.email github-actions@github.com')
await exec.exec(`git add ${databasePath}`)
Expand All @@ -20352,14 +20352,14 @@ async function run () {
// Push changes
if (autoPush) {
// @see: https://github.com/actions-js/push/blob/master/start.sh#L43
core.info("Pushing changes to database and report")
core.info('Pushing changes to database and report')
const remoteRepo = `https://${process.env.INPUT_GITHUB_ACTOR}:${githubToken}@github.com/${process.env.INPUT_REPOSITORY}.git`
await exec.exec(`git push origin ${process.env.GITHUB_HEAD_REF} --force --no-verify --repo ${remoteRepo}`)
}

// Issue creation
if (generateIssue && issueContent) {
core.info("Creating issue...")
core.info('Creating issue...')
await octokit.rest.issues.create({
...context.repo,
title: issueTitle,
Expand Down
16 changes: 8 additions & 8 deletions src/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,25 @@ async function run () {
octokit = github.getOctokit(githubToken)
}

core.info("Checking Scope...")
core.info('Checking Scope...')
const scope = await readFile(scopePath, 'utf8').then(content => JSON.parse(content))
let database = {}

// Check if database exists
try {
core.info("Checking if database exists...")
core.info('Checking if database exists...')
await stat(databasePath)
database = await readFile(databasePath, 'utf8').then(content => JSON.parse(content))
} catch (error) {
core.info('Database does not exist, creating new database')
}

// PROCESS
core.info("Generating scores...")
core.info('Generating scores...')
const { reportContent, issueContent, database: newDatabaseState } = await generateScores({ scope, database, maxRequestInParallel })

// @TODO: If no changes to database, skip the rest of the process
core.info("Checking database changes...")
core.info('Checking database changes...')
const hasChanges = isDifferentContent(database, newDatabaseState)

if (!hasChanges) {
Expand All @@ -61,14 +61,14 @@ async function run () {
}

// Save changes
core.info("Saving changes to database and report")
core.info('Saving changes to database and report')
await writeFile(databasePath, JSON.stringify(newDatabaseState, null, 2))
await writeFile(reportPath, reportContent)

// Commit changes
// @see: https://github.com/actions/checkout#push-a-commit-using-the-built-in-token
if (autoCommit) {
core.info("Committing changes to database and report")
core.info('Committing changes to database and report')
await exec.exec('git config user.name github-actions')
await exec.exec('git config user.email github-actions@github.com')
await exec.exec(`git add ${databasePath}`)
Expand All @@ -79,14 +79,14 @@ async function run () {
// Push changes
if (autoPush) {
// @see: https://github.com/actions-js/push/blob/master/start.sh#L43
core.info("Pushing changes to database and report")
core.info('Pushing changes to database and report')
const remoteRepo = `https://${process.env.INPUT_GITHUB_ACTOR}:${githubToken}@github.com/${process.env.INPUT_REPOSITORY}.git`
await exec.exec(`git push origin ${process.env.GITHUB_HEAD_REF} --force --no-verify --repo ${remoteRepo}`)
}

// Issue creation
if (generateIssue && issueContent) {
core.info("Creating issue...")
core.info('Creating issue...')
await octokit.rest.issues.create({
...context.repo,
title: issueTitle,
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const generateScores = async ({ scope, database: currentDatabase, maxRequestInPa

for (let index = 0; index < chunks.length; index++) {
const chunk = chunks[index]
core.debug(`Processing chunk ${index+1}/${chunks.length}`)
core.debug(`Processing chunk ${index + 1}/${chunks.length}`)

const chunkScores = await Promise.all(chunk.map(async ({ org, repo }) => {
const { score, date } = await getProjectScore({ platform, org, repo })
Expand Down Expand Up @@ -44,7 +44,7 @@ const generateScores = async ({ scope, database: currentDatabase, maxRequestInPa
scores.push(...chunkScores)
}

core.debug(`All the scores are already collected`)
core.debug('All the scores are already collected')

const reportContent = await generateReportContent(scores)
const issueContent = await generateIssueContent(scores)
Expand Down