use github metadata to identify branch to use when editing files
[rnaseq-cwl-training.git] / _includes / gh_default_branch.html
1 {% comment %}
2 identify the default branch of the GitHub repo for the lesson, to create the correct link for "Improve on GitHub"
3 {% endcomment %}
4
5 {% comment %}
6 First, get the name of the repository
7 {% endcomment %}
8 {% assign repo_name = site.github.repository_name %}
9
10 {% comment %}
11 `site.github.public_repositories` contains comprehensive information for all public repositories for the organization. We use `where` to extract the part
12 of the metadata that is relevant to the present repository.
13 {% endcomment %}
14 {% assign repo_info = site.github.public_repositories | where: "name", repo_name %}
15
16 {% comment %}
17 Now, we can extract the default branch for the repo
18 {% endcomment %}
19 {% assign default_branch = repo_info[0].default_branch %}