Skip to content

Commit

Permalink
Merge pull request #5 from UlisesGascon/fix/linting
Browse files Browse the repository at this point in the history
chore: linting
  • Loading branch information
UlisesGascon authored Feb 15, 2023
2 parents e07d7f7 + a166a68 commit a7da550
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
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 [email protected]')
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 [email protected]')
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

0 comments on commit a7da550

Please sign in to comment.