Skip to content

Commit

Permalink
fix(scripts/i18n): fix grabbing commit sha and message (#19340)
Browse files Browse the repository at this point in the history
  • Loading branch information
pieh committed Nov 7, 2019
1 parent 6f422b0 commit 4e2fe45
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scripts/i18n/update-source.js
Expand Up @@ -56,6 +56,12 @@ function cloneOrUpdateRepo(repoName, repoUrl) {
// Copy over contents of origin repo (gatsby) to the source repo (gatsby-source-i18n)
// TODO make sure the main repo is updated before we do this
async function updateSourceRepo() {
// Get potential commit message early (before we "cd" into sourceRepo clone directory) to use last gatsbyjs/gatsby commit
const commitMessage =
shell.exec(
`git log -1 --pretty="sync with monorepo gatsbyjs/gatsby@%H - %B"`
).stdout || `Update from gatsbyjs/gatsby`

logger.info(`Checking if cache directory exists`)
if (shell.cd(cacheDir).code !== 0) {
logger.info(`No cache directory. Creating ${cacheDir}`)
Expand Down Expand Up @@ -83,11 +89,6 @@ async function updateSourceRepo() {
logger.info(`Committing changes`)
shell.exec(`git add .`)

const commitMessage =
shell.exec(
`git log -1 --pretty="sync with monorepo gatsbyjs/gatsby@%H - %B"`
).stdout || `Update from gatsbyjs/gatsby`

if (shell.exec(`git commit -m '${commitMessage}' > /dev/null`).code !== 0) {
logger.error(`Failed to commit to ${sourceRepo}`)
process.exit(1)
Expand Down

0 comments on commit 4e2fe45

Please sign in to comment.