# Action Crowdin Contributors

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

URL: https://store.crowdin.com/action-crowdin-contributors
Identifier: action-crowdin-contributors
Category: Development
Type: Guide
Author: Andrii Bodnar

## 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. It supports both HTML table output (embedded in markdown files) and SVG image generation.

Example:

![Generated SVG with contributors example](https://developers.app.crowdin.net/api/media/file/3a0b09fa-8ddd-4825-b0f4-644b2bcfc7a1.svg)

## Usage

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

Read the [Configuring a workflow](https://help.github.com/en/articles/configuring-a-workflow) article for more details on how to create and set up custom workflows.

```yaml
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 }}
```

### Generating SVG

In addition to the HTML table, you can also generate an SVG image with contributors:

```yaml
- 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 }}
```

### Creating a PR

To create a PR with the updated table, we recommend usage of the [Create Pull Request](https://github.com/peter-evans/create-pull-request) Action:

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

## Options

For more options see the [Marketplace Page](https://github.com/marketplace/actions/action-crowdin-contributors).

## Resources

- [Guide](https://github.com/marketplace/actions/action-crowdin-contributors)
- [Source Code](https://github.com/andrii-bodnar/action-crowdin-contributors)
