{"id":15652405,"url":"https://github.com/linuxsuren/yaml-readme","last_synced_at":"2025-04-15T11:50:50.608Z","repository":{"id":36981313,"uuid":"498565364","full_name":"LinuxSuRen/yaml-readme","owner":"LinuxSuRen","description":"A helper to generate the READE file automatically from YAML-based metadata files.","archived":false,"fork":false,"pushed_at":"2024-05-23T02:19:16.000Z","size":420,"stargazers_count":19,"open_issues_count":9,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T11:16:19.836Z","etag":null,"topics":["github-actions","readme","yaml"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LinuxSuRen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-01T02:30:47.000Z","updated_at":"2025-03-10T07:53:52.000Z","dependencies_parsed_at":"2024-05-23T03:38:30.367Z","dependency_job_id":null,"html_url":"https://github.com/LinuxSuRen/yaml-readme","commit_stats":{"total_commits":44,"total_committers":4,"mean_commits":11.0,"dds":"0.20454545454545459","last_synced_commit":"d746acf13a2cf3fb2c8eeac4b26f95f269d9a904"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinuxSuRen%2Fyaml-readme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinuxSuRen%2Fyaml-readme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinuxSuRen%2Fyaml-readme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinuxSuRen%2Fyaml-readme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LinuxSuRen","download_url":"https://codeload.github.com/LinuxSuRen/yaml-readme/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249067174,"owners_count":21207392,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-actions","readme","yaml"],"created_at":"2024-10-03T12:42:15.993Z","updated_at":"2025-04-15T11:50:50.592Z","avatar_url":"https://github.com/LinuxSuRen.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![codecov](https://codecov.io/gh/LinuxSuRen/yaml-readme/branch/master/graph/badge.svg?token=mnFyeD2IQ7)](https://codecov.io/gh/LinuxSuRen/yaml-readme)\n[![vscode](https://vsmarketplacebadge.apphb.com/version/linuxsuren.yaml-readme.svg)](https://marketplace.visualstudio.com/items?itemName=linuxsuren.yaml-readme)\n\nA helper to generate the READE file automatically.\n\n## Get started\n\nInstall it via [hd](https://github.com/LinuxSuRen/http-downloader/):\n\n```shell\nhd i yaml-readme\n```\n\n## Usage\n\n```shell\n# yaml-readme -h\nUsage:\n  yaml-readme [flags]\n\nFlags:\n  -h, --help              help for yaml-readme\n  -p, --pattern string    The glob pattern with Golang spec to find files (default \"items/*.yaml\")\n  -t, --template string   The template file which should follow Golang template spec (default \"README.tpl\")\n```\n\n### Available variables:\n\n| Name         | Usage                                                                                           |\n|--------------|-------------------------------------------------------------------------------------------------|\n| `filename`   | The filename of a particular item file. For example, `items/good.yaml`, the filename is `good`. |\n| `parentname` | The parent directory name. For example, `items/good.yaml`, the parent name is `items`.          |\n| `fullpath`   | The related file path of each items.                                                            |\n\n### Available functions\n\n| Name                | Usage                                              | Description                                                             |\n|---------------------|----------------------------------------------------|-------------------------------------------------------------------------|\n| `printHelp`         | `{{printHelp 'hd'}}`                               | Print the help text of a command                                        |\n| `printToc`          | `{{printToc}}`                                     | Print the [TOC](https://en.wikipedia.org/wiki/TOC) of the template file |\n| `printContributors` | `{{printContributors \"linuxsuren\" \"yaml-readme\"}}` | Print all the contributors of an repository                             |\n| `printStarHistory`  | `{{printStarHistory \"linuxsuren\" \"yaml-readme\"}}`  | Print the star history of an repository                                 |\n| `printVisitorCount` | `{{printVisitorCount \"repo-id\"}}`                  | Print the visitor count chart of an repository                          |\n| `printPages`        | `{{printPages \"linuxsuren\"}}`                      | Print all the repositories that pages enabled                           |\n| `render`            | `{{render true}}`                                  | Make the value be readable, turn `true` to `:white_check_mark:`         |\n| `gh`                | `{{gh \"linuxsuren\" true}}`                         | Render a GitHub user to be a link                                       | \n| `ghs`               | `{{ghs \"linuxsuren, linuxsuren\" \",\"}}`             | Render multiple GitHub users to be links                                |\n| `link`              | `{{link \"text\" \"link\"}}`                           | Print a Markdown style link                                             |\n| `linkOrEmpty`       | `{{linkOrEmpty \"text\" \"link\"}}`                    | Print a Markdown style link or empty if text is none                    |\n| `ghEmoji`           | `{{ghEmoji \"linuxsuren\"}}`                         | Print a Markdown style link with Emoji                                  |\n\n\u003e Want to use more powerful functions? Please feel free to see also [Sprig](http://masterminds.github.io/sprig/).\n\u003e You could use all functions from both built-in and Sprig.\n\n### Ignore particular items\n\nIn case you want to ignore some particular items, you can put a key `ignore` with value `true`. Let's see the following sample:\n\n```yaml\nname: rick\nignore: true\n```\n\n## Use in GitHub actions\n\nYou could copy the following sample YAML, and change some variables according to your needs.\n```yaml\nname: generator\n\non:\n  push:\n    branches: [ master ]\n\n  workflow_dispatch:\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    if: \"!contains(github.event.head_commit.message, 'ci skip')\"\n\n    steps:\n      - uses: actions/checkout@v3\n      - name: Update readme\n        uses: linuxsuren/yaml-readme@v0.0.6\n        env:\n          GH_TOKEN: ${{ secrets.GH_SECRETS }}\n        with:\n          pattern: 'config/*/*.yml'\n          username: linuxsuren\n          org: linuxsuren\n          repo: hd-home\n```\n\n### Samples\n\nBelow is a simple template sample:\n```gotemplate\nThe total number of tools is: {{len .}}\n| Name | Latest | Download |\n|---|---|---|\n{{- range $val := .}}\n| {{$val.name}} | {{$val.latest}} | {{$val.download}} |\n{{- end}}\n```\n\nBelow is a grouped data sample:\n```gotemplate\n{{- range $key, $val := .}}\nYear: {{$key}}\n| Name | Age |\n|---|---|\n{{- range $item := $val}}\n| {{$item.name}} | {{$item.age}} |\n{{- end}}\n{{end}}\n```\n\nYou could use the following command to render it:\n```shell\nyaml-readme --group-by year\n```\n\nAssume there is a complex YAML like this:\n```yaml\nmetadata:\n  annotations:\n    group/key: 'a value'\n```\n\nthen you can use the following template:\n```gotemplate\n{{index $item.metadata.annotations \"group/key\"}}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinuxsuren%2Fyaml-readme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinuxsuren%2Fyaml-readme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinuxsuren%2Fyaml-readme/lists"}