Show off your DevOps efforts on GitHub
Tags: devops, github, git, tips
Published: 2021-03-16 20:49:22

---
title: Show off your DevOps efforts on GitHub
published: true
description: In the era of DevOps YAML is more than just a data-file, it's a valuable artifact where the core (or just important) logic resides. However GitHub doesn't think so, and it excludes YAMLs from your code stats. Well, that's something we can fix.
tags: devops, github, git, tips
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3sfr2a25drzrs8sc9ry7.png
---

In the era of DevOps some of us write yaml-files on a daily basis. Sometimes it's just a lot of yamls. I would say that in some repositories YAML is more than just 'a data-file', it's a valuable artifact where the core (or just important) logic resides. 

However GitHub doesn't think so. You know that there is a Language Breakdown Graph on every GitHub repository: 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0fi47inpuioi37tlbocf.png)

It looks cool, it highlights the languages used in this repo. 
However, your DevOps efforts are not represented on this chart. No Kubernetes or Docker-Compose manifests and Charts, no CI/CD pipelines, no GitHub Actions, and other sometimes tricky configurations. 

Luckily this is something we can fix. 

### GitHub Linguist

GitHub uses a library called `Linguist` (https://github.com/github/linguist) to analyze your repository. Of course, the Language Breakdown Graph is more of a side-effect and definitely not the main purpose of this analysis. But for now we'll focus on this particular feature of `Linguist`.

All languages known to Linguist can be found in the `languages.yml` file in the linguist repository. 

Let's [check `YAML` definition](https://github.com/github/linguist/blob/072bc3da45b58765db41bd93818121a6ae86aaf2/lib/linguist/languages.yml#L6443)

```yaml
YAML:
  type: data
  color: "#cb171e"
  tm_scope: source.yaml
```

as you can see, it's treated as a data file by default and thus it's left out from the graph.


### Overriding Linguist behavior

We can add (or edit existing) `.gitattributes` file with the following content to the root of our repository:

```bash
*.yml linguist-detectable=true
*.yml linguist-language=YAML
*.yaml linguist-detectable=true
*.yaml linguist-language=YAML
```

and Linguist will respect that override, by showing us a proper Language Breakdown on your page:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2kuhc7vwxfx3kq0c9l5x.png)

Isn't it cool? 

### There is more

It's not just the way YAML files are treated. You can fine-tune that to emphasize the work which is important in *your* opinion. 

Do you have a repository full of Markdown files, perhaps a book that you're writing? Well, [Markdown](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml#L3252-L3254) can be marked as `linguist-detectable` as well.

Do you have some samples or generated files that you want to exclude? `linguist-generated` and `linguist-documentation` attributes can be used. 

You can go wild and mess up with it: 

```bash
# Example of a `.gitattributes` file 
# which reclassifies `.rb` files as Java:
*.rb linguist-language=Java
```

Additional documentation and examples can be found [here](https://github.com/github/linguist/blob/master/docs/overrides.md#summary).

### Call to Action

I hope you enjoyed this little trick. Now go and celebrate your DevOps work by including it in your repository stats.