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

fix(scripts/i18n) Make the sync script work better for integration #22981

Merged
merged 1 commit into from
Apr 9, 2020
Merged
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
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