Skip to content

Commit

Permalink
update frontmatter homogenisation to sweep all translated files (gith…
Browse files Browse the repository at this point in the history
…ub#19117)

Co-authored-by: Sarah Schneider <sarahs@users.noreply.github.com>
Co-authored-by: James M. Greene <417751+JamesMGreene@users.noreply.github.com>
  • Loading branch information
3 people authored May 3, 2021
1 parent e37c943 commit 918bd8a
Show file tree
Hide file tree
Showing 3,206 changed files with 4,643 additions and 4,487 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
39 changes: 22 additions & 17 deletions script/i18n/homogenize-frontmatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,39 @@
//
// [end-readme]

const { execSync } = require('child_process')
const fs = require('fs')
const path = require('path')
const matter = require('gray-matter')
const walk = require('walk-sync')
const readFileAsync = require('../../lib/readfile-async')
const fm = require('../../lib/frontmatter')
const matter = require('gray-matter')

const translationDir = path.posix.join(__dirname, '../../translations')
const translatedMarkdownFiles = walk(translationDir)
.filter(filename => {
return filename.includes('/content/') &&
filename.endsWith('.md') &&
!filename.endsWith('README.md')
})
.map(filename => `translations/${filename}`)

const extractFrontmatter = async (path) => {
const fileContents = await readFileAsync(path, 'utf8')
return fm(fileContents)
}

// Find all content files that differ from the default branch
// TODO: make sure this will work in an Actions workflow
const cmd = 'git -c diff.renameLimit=10000 diff --name-only origin/main'
const changedFilesRelPaths = execSync(cmd)
.toString()
.split('\n')
.filter(filename => {
return filename.startsWith('translations/') &&
filename.includes('/content/') &&
!filename.endsWith('README.md')
})

changedFilesRelPaths.forEach(async (relPath) => {
const localisedAbsPath = path.join(__dirname, '../..', relPath)
translatedMarkdownFiles.forEach(async (relPath) => {
const localisedAbsPath = path.posix.join(__dirname, '../..', relPath)
// find the corresponding english file by removing the first 2 path segments: /translations/<language code>
const engAbsPath = path.join(__dirname, '../..', relPath.split(path.sep).slice(2).join(path.sep))
const engAbsPath = path.posix.join(__dirname, '../..', relPath.split(path.sep).slice(2).join(path.sep))

if (!fs.existsSync(engAbsPath)) {
// This happens when an English file has been moved or deleted and translations are not in sync.
// It does mean this script will not homogenous those translated files, but the docs site does not
// load translated files that don't correlate to an English file, so those translated files can't break things.
console.log(`English file does not exist: ${engAbsPath}`)
return
}

const localisedFrontmatter = await extractFrontmatter(localisedAbsPath)
if (!localisedFrontmatter) return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ redirect_from:
- /actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows
versions:
free-pro-team: '*'
type: 'tutorial'
type: tutorial
topics:
- 'Fluxos de trabalho'
- Workflows
---

{% data reusables.actions.ae-beta %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
title: Fechar problemas inativos
intro: Você pode usar {% data variables.product.prodname_actions %} para comentar ou fechar problemas que ficaram inativos por um determinado período de tempo.
intro: 'Você pode usar {% data variables.product.prodname_actions %} para comentar ou fechar problemas que ficaram inativos por um determinado período de tempo.'
product: '{% data reusables.gated-features.actions %}'
versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'tutorial'
type: tutorial
topics:
- 'Fluxos de trabalho'
- 'Gerenciamento de projeto'
- Workflows
- Project management
---

{% data reusables.actions.enterprise-beta %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
title: Comentar em um problema quando uma etiqueta é adicionada
intro: Você pode usar {% data variables.product.prodname_actions %} para comentar automaticamente nos problema quando uma etiqueta específica é aplicada.
intro: 'Você pode usar {% data variables.product.prodname_actions %} para comentar automaticamente nos problema quando uma etiqueta específica é aplicada.'
product: '{% data reusables.gated-features.actions %}'
versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'tutorial'
type: tutorial
topics:
- 'Fluxos de trabalho'
- 'Gerenciamento de projeto'
- Workflows
- Project management
---

{% data reusables.actions.enterprise-beta %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'tutorial'
type: tutorial
topics:
- 'Contêineres'
- 'Docker'
- Containers
- Docker
---

{% data reusables.actions.enterprise-beta %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'tutorial'
type: tutorial
topics:
- 'Contêineres'
- 'Docker'
- Containers
- Docker
---

{% data reusables.actions.enterprise-beta %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'tutorial'
type: tutorial
topics:
- 'CD'
- 'Contêineres'
- 'Amazon ECS'
- CD
- Containers
- Amazon ECS
---

{% data reusables.actions.enterprise-beta %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'tutorial'
type: tutorial
topics:
- 'CD'
- 'Contêineres'
- 'Serviço do aplicativo Azure'
- CD
- Containers
- Azure App Service
---

{% data reusables.actions.enterprise-beta %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'tutorial'
type: tutorial
topics:
- 'CD'
- 'Contêineres'
- 'Google Kubernetes Engine'
- CD
- Containers
- Google Kubernetes Engine
---

{% data reusables.actions.enterprise-beta %}
Expand Down
3 changes: 3 additions & 0 deletions translations/pt-BR/content/actions/guides/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ includeGuides:
- /actions/guides/building-and-testing-java-with-maven
- /actions/guides/building-and-testing-java-with-gradle
- /actions/guides/building-and-testing-java-with-ant
- /actions/guide/building-and-testing-swift
- /actions/guides/installing-an-apple-certificate-on-macos-runners-for-xcode-development
- /actions/guides/building-and-testing-xamarin-applications
- /actions/guides/publishing-nodejs-packages
- /actions/guides/publishing-java-packages-with-maven
- /actions/guides/publishing-java-packages-with-gradle
Expand Down Expand Up @@ -70,6 +72,7 @@ includeGuides:
- /actions/guides/commenting-on-an-issue-when-a-label-is-added
- /actions/guides/moving-assigned-issues-on-project-boards
- /actions/guides/removing-a-label-when-a-card-is-added-to-a-project-board-column
- /actions/guides/managing-github-actions-with-github-cli
---

<!-- {% link_in_list /about-continuous-integration %} -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'tutorial'
type: tutorial
topics:
- 'CI'
- 'Xcode'
- CI
- Xcode
---

{% data reusables.actions.enterprise-beta %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
title: Transferir problemas atribuídos em quadros de projeto
intro: Você pode usar {% data variables.product.prodname_actions %} para transferir automaticamente um problema para uma coluna específica no quadro de um projeto quando o problema for atribuído.
intro: 'Você pode usar {% data variables.product.prodname_actions %} para transferir automaticamente um problema para uma coluna específica no quadro de um projeto quando o problema for atribuído.'
product: '{% data reusables.gated-features.actions %}'
versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'tutorial'
type: tutorial
topics:
- 'Fluxos de trabalho'
- 'Gerenciamento de projeto'
- Workflows
- Project management
---

{% data reusables.actions.enterprise-beta %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'tutorial'
type: tutorial
topics:
- 'Empacotando'
- 'Publicar'
- 'Docker'
- Packaging
- Publishing
- Docker
---

{% data reusables.actions.enterprise-beta %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'tutorial'
type: tutorial
topics:
- 'Empacotando'
- 'Publicar'
- 'Java'
- 'Gradle'
- Packaging
- Publishing
- Java
- Gradle
---

{% data reusables.actions.enterprise-beta %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'tutorial'
type: tutorial
topics:
- 'Empacotando'
- 'Publicar'
- 'Java'
- 'Maven'
- Packaging
- Publishing
- Java
- Maven
---

{% data reusables.actions.enterprise-beta %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'tutorial'
type: tutorial
topics:
- 'Empacotando'
- 'Publicar'
- ''
- 'JavaScript'
- Packaging
- Publishing
- Node
- JavaScript
---

{% data reusables.actions.enterprise-beta %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
title: Remover uma etiqueta quando um cartão é adicionado à coluna de um quadro de projeto
intro: Você pode usar {% data variables.product.prodname_actions %} para remover automaticamente uma etiqueta quando um problema ou pull request for adicionado a uma coluna específica no quadro de um projeto.
intro: 'Você pode usar {% data variables.product.prodname_actions %} para remover automaticamente uma etiqueta quando um problema ou pull request for adicionado a uma coluna específica no quadro de um projeto.'
product: '{% data reusables.gated-features.actions %}'
versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'tutorial'
type: tutorial
topics:
- 'Fluxos de trabalho'
- 'Gerenciamento de projeto'
- Workflows
- Project management
---

{% data reusables.actions.enterprise-beta %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
title: Agendar a criação de problemas
intro: Você pode usar {% data variables.product.prodname_actions %} para criar um problema regularmente para coisas como reuniões diárias ou revisões trimestrais.
intro: 'Você pode usar {% data variables.product.prodname_actions %} para criar um problema regularmente para coisas como reuniões diárias ou revisões trimestrais.'
product: '{% data reusables.gated-features.actions %}'
versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'tutorial'
type: tutorial
topics:
- 'Fluxos de trabalho'
- 'Gerenciamento de projeto'
- Workflows
- Project management
---

{% data reusables.actions.enterprise-beta %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'tutorial'
type: tutorial
topics:
- 'Fluxos de trabalho'
- 'CI'
- Workflows
- CI
---

{% data reusables.actions.enterprise-beta %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'tutorial'
type: tutorial
topics:
- 'Fluxos de trabalho'
- Workflows
---

{% data reusables.actions.enterprise-beta %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ versions:
github-ae: '*'
type: overview
topics:
- Gerenciamento de projeto
- Project management
---

Você pode usar {% data variables.product.prodname_actions %} para automatizar suas tarefas de gerenciamento de projeto, criando fluxos de trabalho. Cada fluxo de trabalho contém uma série de tarefas que são executadas automaticamente toda vez que o fluxo de trabalho é executado. Por exemplo, você pode criar um fluxo de trabalho que é executado toda vez que um problema é criado para adicionar uma etiqueta, deixar um comentário e transferir um problema para um quadro de projeto.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ redirect_from:
versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: tutorial
---

{% data reusables.actions.enterprise-beta %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'tutorial'
type: tutorial
defaultPlatform: linux
---

Expand Down
Loading

0 comments on commit 918bd8a

Please sign in to comment.