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

Post the validate_translaiton output as a pull request comment #566

Closed
OmarIthawi opened this issue Aug 18, 2023 · 1 comment
Closed

Post the validate_translaiton output as a pull request comment #566

OmarIthawi opened this issue Aug 18, 2023 · 1 comment

Comments

@OmarIthawi
Copy link
Member

OmarIthawi commented Aug 18, 2023

Description

Add the following to the validate-translation-files.yml for better Developer Experience:

      - name: Validate translation files
        id: validate_translation_files
        run: |
          make validate_translation_files 2>&1 > make_output.txt

      - name: Send failure comment
        if: failure()
        uses: actions/github-script@v5
        with:
          script: |
            const fs = require('fs');
            const makeOutput = fs.readFileSync('make_output.txt', 'utf8');

            const comment = `
            This pull request contains invalid translation files. Please fix the errors and push again.

            <details><summary>Output from `make validate_translation_files`</summary>
            \`\`\`
            ${makeOutput}
            \`\`\`
            </details>

            This comment was posted by the `validate-translation-files.yml` GitHub workflow.
            `;

            github.rest.issues.createComment({
              owner: context.repo.owner,
              repo: context.repo.repo,
              issue_number: context.issue.number,
              body: comment,
            });

            github.rest.issues.addLabels({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              labels: ['translations-error'],
            })

Related PR

This is related to #564

@OmarIthawi OmarIthawi changed the title Add post the translations i18n output Post the validate_translaiton output as a pull request comment Sep 9, 2023
@OmarIthawi
Copy link
Member Author

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant