Skip to content

Commit

Permalink
chore: improve action logging
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael-papazikas committed Apr 26, 2024
1 parent 85e6d45 commit 31f2de0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
1 change: 0 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"project": "./tsconfig.json"
},
"rules": {
"no-console": "off",
"i18n-text/no-en": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
Expand Down
24 changes: 12 additions & 12 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ async function run(): Promise<void> {
try {
shell.config.fatal = true

console.log('Configuring Git')
core.info('Configuring Git')
shell.exec(`git config --global user.name "${config.owner}"`)
shell.exec(`git config --global user.email "robot@example.com"`)

shell.mkdir('-p', config.clonePath)
shell.cd(config.clonePath)

console.log('Cloning Repository')
core.info('Cloning Repository')
shell.exec(`git clone ${config.repoUrl}`)
shell.cd(config.repoDirectory)
if (config.git_name) {
Expand All @@ -78,18 +78,18 @@ async function run(): Promise<void> {
shell.exec(`git config user.email "${config.git_email}"`)
}

console.log('Creating Branch')
core.info('Creating Branch')
shell.exec(`git checkout -B ${config.branch}`)

console.log('Bump Version')
core.info('Bump Version')
await bumpVersions(config)

console.log('Committing Changes')
core.info('Committing Changes')
shell.exec(`git add .`)
shell.exec(`git commit -m "${config.commitMsg}"`)
shell.exec(`git push -u origin ${config.branch}`)

console.log('Creating Pull Request')
core.info('Creating Pull Request')
const resp = await github.getOctokit(config.PAT).rest.pulls.create({
owner: config.owner,
repo: config.repo,
Expand All @@ -98,11 +98,11 @@ async function run(): Promise<void> {
base: config.base
})

console.log('Pull Request Created')
console.log(resp.data)
core.info('Pull Request Created')
core.debug(JSON.stringify(resp.data))

if (String(config.auto_merge) === 'true') {
console.log('Auto Merge is configured')
core.info('Auto Merge is configured')
const mergeResponse = await github
.getOctokit(config.PAT)
.rest.pulls.merge({
Expand All @@ -111,13 +111,13 @@ async function run(): Promise<void> {
pull_number: resp.data.number,
merge_method: 'squash'
})
console.log('Merge Response')
console.log(mergeResponse.data)
core.debug('Merge Response')
core.debug(JSON.stringify(mergeResponse.data))
}
} catch (e) {
if (e instanceof Error) core.setFailed(e.message)
}
console.log('Cleanup')
core.info('Cleanup')
shell.rm('-rf', config.clonePath)
}

Expand Down

0 comments on commit 31f2de0

Please sign in to comment.