Skip to content

Commit

Permalink
Make the sync script work better for integration (#22981)
Browse files Browse the repository at this point in the history
  • Loading branch information
tesseralis authored Apr 9, 2020
1 parent f1a9616 commit 6b8aa5a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions scripts/i18n/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ let logger = log4js.getLogger(`sync`)

require(`dotenv`).config()

const host = `https://github.com`
const token = process.env.GITHUB_API_TOKEN
const host = `https://${token}@github.com`
const cacheDir = `.cache`
const owner = `gatsbyjs`
const repoBase = `gatsby`
Expand Down Expand Up @@ -53,7 +54,7 @@ async function getRepository(owner, name) {
`,
{
headers: {
authorization: `token ${process.env.GITHUB_ADMIN_AUTH_TOKEN}`,
authorization: `token ${token}`,
},
owner,
name,
Expand All @@ -76,7 +77,7 @@ async function createLabel(input) {
`,
{
headers: {
authorization: `token ${process.env.GITHUB_BOT_AUTH_TOKEN}`,
authorization: `token ${token}`,
accept: `application/vnd.github.bane-preview+json`,
},
input,
Expand All @@ -99,7 +100,7 @@ async function createPullRequest(input) {
`,
{
headers: {
authorization: `token ${process.env.GITHUB_BOT_AUTH_TOKEN}`,
authorization: `token ${token}`,
accept: `application/vnd.github.shadow-cat-preview+json`,
},
input,
Expand All @@ -119,7 +120,7 @@ async function addLabelToPullRequest(pullRequest, label) {
`,
{
headers: {
authorization: `token ${process.env.GITHUB_BOT_AUTH_TOKEN}`,
authorization: `token ${token}`,
accept: `application/vnd.github.bane-preview+json`,
},
input: {
Expand Down Expand Up @@ -232,7 +233,7 @@ async function syncTranslationRepo(code) {
// Remove files that are deleted by upstream
// https://stackoverflow.com/a/54232519
shell.exec(`git diff --name-only --diff-filter=U | xargs git rm`)
shell.exec(`git ci --no-edit`)
shell.exec(`git commit --no-edit`)

shell.exec(`git push -u origin ${syncBranch}`)

Expand Down

0 comments on commit 6b8aa5a

Please sign in to comment.