Skip to content

Release candidate v8.7.0 #75

Release candidate v8.7.0

Release candidate v8.7.0 #75

name: Check for non-English updates outside of Crowdin
on:
pull_request:
paths:
- "public/content/translations/**/*.md"
- "src/intl/**/*.json"
- "!src/intl/en/**"
jobs:
check_and_label:
runs-on: ubuntu-latest
steps:
- name: Exit early if branch name contains 'crowdin' or is 'dev', 'staging', or 'master'
id: check_branch
run: |
if [[ "${{ github.head_ref }}" == *crowdin* ]] ||
[[ "${{ github.ref }}" == 'refs/heads/dev' ]] ||
[[ "${{ github.ref }}" == 'refs/heads/staging' ]] ||
[[ "${{ github.ref }}" == 'refs/heads/master' ]]
then
echo "Branch name contains 'crowdin' or is 'dev', 'staging', or 'master', stopping workflow"
echo "::set-output name=skip::true"
exit 0
else
echo "::set-output name=skip::false"
fi
- name: Checkout code
if: steps.check_branch.outputs.skip == 'false'
uses: actions/checkout@v2
- name: Check changes
if: steps.check_branch.outputs.skip == 'false'
id: check_changes
run: |
git fetch origin ${{ github.base_ref }}
DIFF=$(git diff --no-ext-diff --unified=0 origin/${{ github.base_ref }}..${{ github.head_ref }} -- 'public/content/translations/**/*.md' 'src/intl/**/*.json' '!src/intl/en/**' | grep -E -v '^[-+]href=')
if [[ -z "$DIFF" ]]; then
echo "ALL_CHANGES_INCLUDE_HREF=true" >> $GITHUB_ENV
else
echo "ALL_CHANGES_INCLUDE_HREF=false" >> $GITHUB_ENV
fi
echo "::set-output name=all_changes_include_href::$ALL_CHANGES_INCLUDE_HREF"
- name: Add label and comment
if: steps.check_branch.outputs.skip == 'false'
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const prNumber = context.issue.number;
const repo = context.repo;
const prAuthor = context.payload.pull_request.user.login;
const allChangesIncludeHref = '${{ steps.check_changes.outputs.all_changes_include_href }}' === 'true';
const status = allChangesIncludeHref ? 'question ❓' : 'Status: Blocked 🛑';
await github.rest.issues.addLabels({
...repo,
issue_number: prNumber,
labels: [status, 'non-crowdin translation updates']
});
const commentWithoutHrefs = `This pull request contains changes to non-English content, which must also be handled through the Crowdin platform instead of only on GitHub.`
const commentWithHrefs = `This pull request contains changes to non-English content files, which may also need to be handled through the Crowdin platform instead of only on GitHub.`
await github.rest.issues.createComment({
...repo,
issue_number: prNumber,
body: `
Thank you for your contribution, @${prAuthor}!
${allChangesIncludeHref ? commentWithHrefs : commentWithoutHrefs}
We value your suggestion, and for any non-English content updates we request that you check out [how to help us translate](https://ethereum.org/en/contributing/translation-program/#help-us-translate), and suggest these updates directly in [our Crowdin project](https://crowdin.com/project/ethereum-org) if possible, where they can be properly reviewed.
Please post here or join [our Discord](https://ethereum.org/discord) if you have questions!
`
});