Skip to content

andrii-bodnar/action-crowdin-contributors

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Crowdin Contributors Tweet GitHub Repo stars

A GitHub action to automate acknowledging translators and proofreaders to your projects ✨

Check dist build-test e2e-test codecov

What does this action do?

This action downloads the Top Members report and generates or updates a contributors' table in your project based on this report and the action configuration.

Usage

Set up a workflow in .github/workflows/crowdin-contributors.yml (or add a job to your existing workflows).

Read the Configuring a workflow article for more details on how to create and set up custom workflows.

name: Crowdin Contributors Action

on:
  # When you push to the `main` branch
  push:
    branches: [main]
  # And optionally, once every 12 hours
  schedule:
    - cron: '0 */12 * * *' # https://crontab.guru/#0_*/12_*_*_*
  # To manually run this workflow
  workflow_dispatch:

jobs:
  crowdin-contributors:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6

      - name: Generate Crowdin Contributors table
        uses: andrii-bodnar/action-crowdin-contributors@v3
        with:
          contributors_per_line: 8
          max_contributors: 32
          image_size: 64
          min_words_contributed: 256
        env:
          CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
          CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
          CROWDIN_ORGANIZATION: ${{ secrets.CROWDIN_ORGANIZATION }} # Optional. Only for Crowdin Enterprise

Creating a PR

To create a PR with the updated table, we recommend usage of the Create Pull Request Action:

name: Crowdin Contributors Action

on:
  # When you push to the `main` branch
  push:
    branches: [main]
  # And optionally, once every 12 hours
  schedule:
    - cron: '0 */12 * * *' # https://crontab.guru/#0_*/12_*_*_*
  # To manually run this workflow
  workflow_dispatch:

jobs:
  crowdin-contributors:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6

      - name: Generate Crowdin Contributors table
        uses: andrii-bodnar/action-crowdin-contributors@v3
        with:
          contributors_per_line: 8
          max_contributors: 32
          image_size: 64
          min_words_contributed: 256
        env:
          CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
          CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
          CROWDIN_ORGANIZATION: ${{ secrets.CROWDIN_ORGANIZATION }} # Optional. Only for Crowdin Enterprise

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v8
        with:
          title: Update Crowdin Contributors table
          body: By [action-crowdin-contributors](https://github.com/andrii-bodnar/action-crowdin-contributors) GitHub action
          commit-message: Update Crowdin Contributors table
          committer: Crowdin Bot <support+bot@crowdin.com>
          branch: crowdin-contributors/patch

Generating SVG

In addition to the HTML table, you can also generate an SVG image with contributors. This is useful when you want a visual graphic that can be embedded anywhere:

name: Crowdin Contributors Action

on:
  workflow_dispatch:

jobs:
  crowdin-contributors:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6

      - name: Generate Crowdin Contributors
        uses: andrii-bodnar/action-crowdin-contributors@v3
        with:
          svg: true
          svg_output_path: 'docs/CONTRIBUTORS.svg'
          contributors_per_line: 8
          max_contributors: 32
          image_size: 64
        env:
          CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
          CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

When svg: true is set, the action will generate both the HTML table (in the configured files) and the SVG image. You can then embed the SVG in your README or any other markdown file:

## Contributors

![Crowdin Contributors](docs/CONTRIBUTORS.svg)

Options

Option Default value Description
max_contributors 30 Only the specified amount of contributors will be shown
min_words_contributed 100 Minimum words contributed (both translated and approved)
contributors_per_line 7 Maximum number of columns for the contributors table
image_size 100 Size (in px) of the user's avatar
files README.md Array of files to update
crowdin_project_link Crowdin project link will be added after the contributors' table
include_languages false Specifies whether to include contributed languages in table
excluded_users List of usernames to exclude from the contributors table
placeholder_start <!-- CROWDIN-CONTRIBUTORS-START --> Placeholder that marks the start of the contributors table
placeholder_end <!-- CROWDIN-CONTRIBUTORS-END --> Placeholder that marks the end of the contributors table
svg false Generate contributors in SVG format instead of HTML table
svg_output_path CONTRIBUTORS.svg Path to the output SVG file (when svg mode is enabled)

Outputs

This actions provides the following outputs that can be used by other steps in your workflow:

Output Description
contributors_table Generated table with contributors
json_report JSON report with contributors used to render a table
svg_path Path to the generated SVG file (when svg mode is enabled)

Demo

The action can generate both HTML table and SVG image.

Generated SVG:

svg-demo

HTML table:

demo

Note: it's just a test, in real use, it will display actual user's avatars.

Example PR - #6

In addition, the contributors' table will be added as a summary to the workflow job run.

Contributing

If you want to contribute please read the Contributing guidelines.

Author

License

The Crowdin Contributors Action is licensed under the MIT License.
See the LICENSE file distributed with this work for additional
information regarding copyright ownership.

Except as contained in the LICENSE file, the name(s) of the above copyright
holders shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written authorization.

About

A GitHub action to automate acknowledging translators and proofreaders to your projects ✨

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors