Back to Metrics

README

source/plugins/contributors/README.md

3.346.5 KB
Original Source
<!--header--> <table> <tr><td colspan="2"><a href="/README.md#-plugins">โ† Back to plugins index</a></td></tr> <tr><th colspan="2"><h3>๐Ÿ… Repository contributors</h3></th></tr> <tr><td colspan="2" align="center"><p>This plugin display repositories contributors from a commit range along with additional stats.</p> </td></tr> <tr><th>โš ๏ธ Disclaimer</th><td><p>This plugin is not affiliated, associated, authorized, endorsed by, or in any way officially connected with <a href="https://github.com">GitHub</a>. All product and company names are trademarksโ„ข or registeredยฎ trademarks of their respective holders.</p> </td></tr> <tr> <th rowspan="3">Supported features <sub><a href="metadata.yml">โ†’ Full specification</a></sub></th> <td><a href="/source/templates/repository/README.md"><code>๐Ÿ“˜ Repository template</code></a></td> </tr> <tr> <td><code>๐Ÿ““ Repositories</code></td> </tr> <tr> <td><code>๐Ÿ”‘ (scopeless)</code> <code>read:org (optional)</code> <code>read:user (optional)</code> <code>read:packages (optional)</code> <code>repo (optional)</code></td> </tr> <tr> <td colspan="2" align="center"> <details open><summary>By contribution types</summary></img></details> <details><summary>By number of contributions</summary></img></details>
</td>
</tr> </table> <!--/header-->

โžก๏ธ Available options

<!--options--> <table> <tr> <td align="center" nowrap="nowrap">Option</i></td><td align="center" nowrap="nowrap">Description</td> </tr> <tr> <td nowrap="nowrap"><h4><code>plugin_contributors</code></h4></td> <td rowspan="2"><p>Enable contributors plugin</p> </td> </tr> <tr> <td nowrap="nowrap"><b>type:</b> <code>boolean</code>

<b>default:</b> no

</td> </tr> <tr> <td nowrap="nowrap"><h4><code>plugin_contributors_base</code></h4></td> <td rowspan="2"><p>Base reference</p> <p>Can be a commit, tag, branch, etc.</p> </td> </tr> <tr> <td nowrap="nowrap"><b>type:</b> <code>string</code> </td> </tr> <tr> <td nowrap="nowrap"><h4><code>plugin_contributors_head</code></h4></td> <td rowspan="2"><p>Head reference</p> <p>Can be a commit, tag, branch, etc.</p> </td> </tr> <tr> <td nowrap="nowrap"><b>type:</b> <code>string</code>

<b>default:</b> master

</td> </tr> <tr> <td nowrap="nowrap"><h4><code>plugin_contributors_ignored</code></h4></td> <td rowspan="2"><p>Ignored users</p> <p>Can be used to ignore bots activity</p> </td> </tr> <tr> <td nowrap="nowrap">โฉ Inherits <code>users_ignored</code>

<b>type:</b> <code>array</code> <i>(comma-separated)</i>

</td> </tr> <tr> <td nowrap="nowrap"><h4><code>plugin_contributors_contributions</code></h4></td> <td rowspan="2"><p>Contributions count</p> </td> </tr> <tr> <td nowrap="nowrap"><b>type:</b> <code>boolean</code>

<b>default:</b> no

</td> </tr> <tr> <td nowrap="nowrap"><h4><code>plugin_contributors_sections</code></h4></td> <td rowspan="2"><p>Displayed sections</p> <ul> <li><code>contributors</code>: all contributors</li> <li><code>categories</code>: contributors sorted by contributions categories (must be configured with <a href="/source/plugins/contributors/README.md#plugin_contributors_categories"><code>plugin_contributors_categories</code></a>)</li> </ul> </td> </tr> <tr> <td nowrap="nowrap"><b>type:</b> <code>array</code> <i>(comma-separated)</i>

<b>default:</b> contributors

<b>allowed values:</b><ul><li>contributors</li><li>categories</li></ul></td>

</tr> <tr> <td nowrap="nowrap"><h4><code>plugin_contributors_categories</code></h4></td> <td rowspan="2"><p>Contribution categories</p> <p>This option requires <a href="/source/plugins/contributors/README.md#plugin_contributors_sections"><code>plugin_contributors_sections</code></a> to have <code>categories</code> in it to be effective. Pass a JSON object mapping category with file globs</p> </td> </tr> <tr> <td nowrap="nowrap">๐ŸŒ Web instances must configure <code>settings.json</code>: <ul> <li><i>metrics.run.tempdir</i></li> <li><i>metrics.run.git</i></li> </ul> <b>type:</b> <code>json</code>

<b>default:</b> <details><summary>โ†’ Click to expand</summary><pre language="json"><code>{ "๐Ÿ“š Documentation": ["README.md", "docs/"], "๐Ÿ’ป Code": ["source/", "src/**"], "#๏ธโƒฃ Others": ["*"] } </code></pre></details>

</td> </tr> </table> <!--/options-->

๐Ÿ—‚๏ธ Setting up contribution categories

Pass a JSON object to plugin_contributors_categories with categories names as keys and arrays of file globs as values to configure contributions categories.

Each modified file by a contributor matching a file glob will add them in said category.

๐Ÿ’ก File matching respect keys order

๐Ÿ’ก Use | YAML multiline operator for better readability

*Example: *

yaml
- uses: lowlighter/metrics@latest
  with:
    plugin_contributors: yes
    plugin_contributors_categories: |
      {
        "๐Ÿ“š Documentation": ["README.md", "docs/**"],
        "๐Ÿ’ป Code": ["source/**", "src/**"],
        "#๏ธโƒฃ Others": ["*"]
      }

โ„น๏ธ Examples workflows

<!--examples-->
yaml
name: Contributors with contributions count
uses: lowlighter/metrics@latest
with:
  filename: metrics.plugin.contributors.contributions.svg
  token: ${{ secrets.METRICS_TOKEN }}
  base: ""
  template: repository
  repo: metrics
  plugin_contributors: yes
  plugin_contributors_contributions: yes

yaml
name: Contributors by categories
uses: lowlighter/metrics@latest
with:
  filename: metrics.plugin.contributors.categories.svg
  token: ${{ secrets.METRICS_TOKEN }}
  base: ""
  template: repository
  repo: metrics
  plugin_contributors: yes
  plugin_contributors_sections: categories
  plugin_contributors_categories: |
    {
      "๐Ÿงฉ Plugins / ๐Ÿ–ผ๏ธ templates":["source/plugins/**", "source/templates/**"],
      "๐Ÿ“š Documentation":["README.md", "**/README.md", "**/metadata.yml"],
      "๐Ÿ’ป Code (other)":["source/**", "Dockerfile"]
    }

<!--/examples-->