action-crowdin-contributors

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

MIT License

Stars
13
Committers
2

Crowdin Contributors Tweet GitHub Repo stars

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

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@v4

    - name: Generate Crowdin Contributors table
      uses: andrii-bodnar/action-crowdin-contributors@v2
      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@v4

    - name: Generate Crowdin Contributors table
      uses: andrii-bodnar/action-crowdin-contributors@v2
      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@v6
      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 <[email protected]>
        branch: crowdin-contributors/patch

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
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

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

Demo

The resulting table will look like this:

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

Package Rankings
Top 10.55% on Github actions
Badges
Extracted from project README
Tweet GitHub Repo stars Check dist build-test e2e-test codecov
Related Projects