Remove software carpentries logo
[rnaseq-cwl-training.git] / _includes / gh_variables.html
1 {% comment %}
2 When rendering websites locally, `site.github.url` doesn't get resolved properly
3 unless a GitHub Personal Access Token is set up and available in the
4 environment. This leads to warnings and errors when trying to serve the site
5 locally. To work around this, we use the `jekyll.environment` variable which is
6 set to `development` when rendering the site locally, and set to `production` on
7 GitHub where `site.github.url` is defined.
8 {% endcomment %}
9
10 {% if jekyll.environment == "production" %}
11
12 {% comment %}
13 First, get the name of the repository
14 {% endcomment %}
15 {% assign repo_name = site.github.repository_name %}
16
17 {% comment %}
18 `site.github.public_repositories` contains comprehensive information for all public repositories for the organization. We use `where` to extract the part
19 of the metadata that is relevant to the present repository.
20 {% endcomment %}
21 {% assign repo_info = site.github.public_repositories | where: "name", repo_name %}
22
23 {% comment %}
24 Now, we can extract the default branch for the repo
25 {% endcomment %}
26 {% assign default_branch = repo_info[0].default_branch %}
27
28 {% comment %}
29 Other variables requested by the template
30 {% endcomment %}
31 {% assign repo_url = site.github.repository_url %}
32 {% assign search_domain_url = site.github.url %}
33 {% assign project_title = site.github.project_title %}
34 {% assign source_branch = site.github.source.branch %}
35
36 {% elsif jekyll.environment == "development" %}
37
38 {% assign repo_name = "" %}
39 {% assign repo_url = "" %}
40 {% assign default_branch = "" %}
41 {% assign search_domain_url = "" %}
42 {% assign project_title = "" %}
43 {% assign source_branch = "" %}
44
45 {% endif %}