Skip to content

Commit

Permalink
chore: Add missing code fence languages (github#772)
Browse files Browse the repository at this point in the history
* chore: Add missing code fence languages

* Update content/actions/creating-actions/dockerfile-support-for-github-actions.md

* Add raw & endraw markers around shell content

See review comment by @rachmari

* Add raw & endraw markers around shell content

See review comment by @rachmari

* Remove language from code fences

to avoid the problem of replaceable text indicates like
<this> not showing up in the output page.

Co-authored-by: hubwriter <[email protected]>
  • Loading branch information
nschonni and hubwriter authored Jan 18, 2021
1 parent b9df88a commit d9167f1
Show file tree
Hide file tree
Showing 36 changed files with 132 additions and 119 deletions.
2 changes: 1 addition & 1 deletion content/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ https://github-images.s3.amazonaws.com/enterprise/2.20/assets/images/help/profil

Sometimes you want to link to a Dotcom-only article in Enterprise content and you don't want the link to be Enterprise-ified. To prevent the transformation, write the link using HTML and add a class of `dotcom-only`. For example:

```
```html
<a href="/github/site-policy/github-terms-of-service" class="dotcom-only">GitHub's Terms of Service</a>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,21 @@ The Docker `ENTRYPOINT` instruction has a _shell_ form and _exec_ form. The Dock

If you configure your container to use the _exec_ form of the `ENTRYPOINT` instruction, the `args` configured in the action's metadata file won't run in a command shell. If the action's `args` contain an environment variable, the variable will not be substituted. For example, using the following _exec_ format will not print the value stored in `$GITHUB_SHA`, but will instead print `"$GITHUB_SHA"`.

```
```dockerfile
ENTRYPOINT ["echo $GITHUB_SHA"]
```

If you want variable substitution, then either use the _shell_ form or execute a shell directly. For example, using the following _exec_ format, you can execute a shell to print the value stored in the `GITHUB_SHA` environment variable.

```
```dockerfile
ENTRYPOINT ["sh", "-c", "echo $GITHUB_SHA"]
````
```

To supply `args` defined in the action's metadata file to a Docker container that uses the _exec_ form in the `ENTRYPOINT`, we recommend creating a shell script called `entrypoint.sh` that you call from the `ENTRYPOINT` instruction:

##### Example *Dockerfile*
```

```dockerfile
# Container image that runs your code
FROM debian:9.5-slim

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ For more information, see "[Creating a JavaScript action](/articles/creating-a-j

If you are creating a Docker container action, you can set a failure exit code in your `entrypoint.sh` script. For example:

{% raw %}
```
if <condition> ; then
echo "Game over!"
exit 1
fi
```
{% endraw %}

For more information, see "[Creating a Docker container action](/articles/creating-a-docker-container-action)."
2 changes: 1 addition & 1 deletion content/actions/guides/building-and-testing-nodejs.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ steps:

The example above creates an *.npmrc* file with the following contents:

```
```ini
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
@octocat:registry=https://registry.npmjs.org/
always-auth=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ A cache key can include any of the contexts, functions, literals, and operators
Using expressions to create a `key` allows you to automatically create a new cache when dependencies have changed. For example, you can create a `key` using an expression that calculates the hash of an npm `package-lock.json` file.

{% raw %}
```
```yaml
npm-${{ hashFiles('package-lock.json') }}
```
{% endraw %}

{% data variables.product.prodname_dotcom %} evaluates the expression `hash "package-lock.json"` to derive the final `key`.

```
```yaml
npm-d5ea0750
```

Expand All @@ -144,7 +144,7 @@ You can provide a list of restore keys to use when there is a cache miss on `key
#### Example using multiple restore keys

{% raw %}
```
```yaml
restore-keys: |
npm-foobar-${{ hashFiles('package-lock.json') }}
npm-foobar-
Expand All @@ -155,7 +155,7 @@ restore-keys: |
The runner evaluates the expressions, which resolve to these `restore-keys`:

{% raw %}
```
```yaml
restore-keys: |
npm-foobar-d5ea0750
npm-foobar-
Expand Down
4 changes: 2 additions & 2 deletions content/actions/guides/publishing-nodejs-packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
In the example above, the `setup-node` action creates an *.npmrc* file on the runner with the following contents:

```
```ini
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
registry=https://registry.npmjs.org/
always-auth=true
Expand Down Expand Up @@ -140,7 +140,7 @@ jobs:

The `setup-node` action creates an *.npmrc* file on the runner. When you use the `scope` input to the `setup-node` action, the *.npmrc* file includes the scope prefix. By default, the `setup-node` action sets the scope in the *.npmrc* file to the account that contains that workflow file.

```
```ini
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
@octocat:registry=https://npm.pkg.github.com
always-auth=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
You can define a custom retention period for individual artifacts created by a workflow. When using a workflow to create a new artifact, you can use `retention-days` with the `upload-artifact` action. This example demonstrates how to set a custom retention period of 5 days for the artifact named `my-artifact`:

```
```yaml
- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ If setting environment variables is not practical, you can set the proxy configu

An example _.env_ proxy configuration is shown below:

```
```ini
https_proxy=http://proxy.local:8080
no_proxy=example.com,myserver.local:443
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,30 @@ https://github.com/<OWNER>/<REPOSITORY>/workflows/<WORKFLOW_FILE_PATH>/badge.svg

This Markdown example adds a status badge for a workflow with the name "Greet Everyone." The `OWNER` of the repository is the `actions` organization and the `REPOSITORY` name is `hello-world`.

```
```markdown
![example workflow name](https://github.com/actions/hello-world/workflows/Greet%20Everyone/badge.svg)
```

### Using a workflow file path

This Markdown example adds a status badge for a workflow with the file path `.github/workflows/main.yml`. The `OWNER` of the repository is the `actions` organization and the `REPOSITORY` name is `hello-world`.

```
```markdown
![example workflow file path](https://github.com/actions/hello-world/workflows/.github/workflows/main.yml/badge.svg)
```

### Using the `branch` parameter

This Markdown example adds a status badge for a branch with the name `feature-1`.

```
```markdown
![example branch parameter](https://github.com/actions/hello-world/workflows/Greet%20Everyone/badge.svg?branch=feature-1)
```

### Using the `event` parameter

This Markdown example adds a badge that displays the status of workflow runs triggered by the `pull_request` event.

```
```markdown
![example event parameter](https://github.com/actions/hello-world/workflows/Greet%20Everyone/badge.svg?event=pull_request)
```
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ During the execution of a workflow, the runner generates temporary files that ca

**Warning:** Powershell does not use UTF-8 by default. Make sure you write files using the correct encoding. For example, you need to set UTF-8 encoding when you set the path:

```
```yaml
steps:
- run: echo "mypath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
```
Expand Down Expand Up @@ -287,7 +287,7 @@ For multiline strings, you may use a delimiter with the following syntax.
##### Example
In this example, we use `EOF` as a delimiter and set the `JSON_RESPONSE` environment variable to the value of the curl response.
```
```yaml
steps:
- name: Set the value
id: step_one
Expand Down
14 changes: 12 additions & 2 deletions content/admin/enterprise-management/evacuating-a-cluster-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,46 @@ If you're taking a node offline that has any data services (like git, pages, or
$ ghe-config cluster._hostname_.uuid
```
2. You'll need to monitor the status of your node while the data is being copied. Ideally, the node shouldn't be taken offline until the copying is complete. To monitor the status of your node, run any of the following commands:
2. You'll need to monitor the status of your node while the data is being copied. Ideally, the node shouldn't be taken offline until the copying is complete. To monitor the status of your node, run any of the following commands:
For Git
```
ghe-spokes evac-status
```
For {% data variables.product.prodname_pages %}
{% raw %}
```
echo "select count(*) from pages_replicas where host = 'pages-server-<uuid>'" | ghe-dbconsole -y
```
{% endraw %}
For storage
```
ghe-storage evacuation-status
```
3. After the copying is complete, you can evacuate the storage service. Run any of the following commands:
3. After the copying is complete, you can evacuate the storage service. Run any of the following commands:
For Git
{% raw %}
```
ghe-spokes server evacuate git-server-<uuid>
```
{% endraw %}
For {% data variables.product.prodname_pages %}
{% raw %}
```
ghe-dpages evacuate pages-server-<uuid>
```
{% endraw %}
For storage, take the node offline
{% raw %}
```
ghe-storage offline storage-server-<uuid>
```
{% endraw %}
then evacuate
{% raw %}
```
ghe-storage evacuate storage-server-<uuid>
```
{% endraw %}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The names of the nodes can be any valid hostname you choose. The names are set a

Specify the first cluster node you configured as the MySQL primary via `mysql-server` and `mysql-master`.

```
```ini
[cluster]
mysql-master = ghe-data-node-1
redis-master = ghe-data-node-1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ This example demonstrates using the `actions-sync` tool to sync an individual ac
* You can sync multiple actions by replacing the `--repo-name` parameter with `--repo-name-list` or `--repo-name-list-file`. For more information, see the [`actions-sync` README](https://github.com/actions/actions-sync#actions-sync).
1. After the action repository is created on your enterprise instance, people in your enterprise can use the destination repository to reference the action in their workflows. For the example action shown above:

```
```yaml
uses: synced-actions/docker-build-push-action@v1
```
Expand Down
50 changes: 25 additions & 25 deletions content/admin/policies/creating-a-pre-receive-hook-script.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ versions:
You can see examples of pre-receive hooks for {% data variables.product.prodname_ghe_server %} in the [`github/platform-samples` repository](https://github.com/github/platform-samples/tree/master/pre-receive-hooks).

### Writing a pre-receive hook script
A pre-receive hook script executes in a pre-receive hook environment on the {% data variables.product.prodname_ghe_server %} appliance. When you create a pre-receive hook script, consider the available input, output, exit-status and environment variables.
A pre-receive hook script executes in a pre-receive hook environment on the {% data variables.product.prodname_ghe_server %} appliance. When you create a pre-receive hook script, consider the available input, output, exit-status and environment variables.

#### Input (stdin)
After a push occurs and before any refs are updated on the remote repository, the `git-receive-pack` process invokes the pre-receive hook script with the standard input of one line per ref to be updated:
Expand Down Expand Up @@ -94,30 +94,30 @@ You can test a pre-receive hook script locally before you create or update it on

2. Create a file called `Dockerfile.dev` containing:

```
FROM gliderlabs/alpine:3.3
RUN \
apk add --no-cache git openssh bash && \
ssh-keygen -A && \
sed -i "s/#AuthorizedKeysFile/AuthorizedKeysFile/g" /etc/ssh/sshd_config && \
adduser git -D -G root -h /home/git -s /bin/bash && \
passwd -d git && \
su git -c "mkdir /home/git/.ssh && \
ssh-keygen -t ed25519 -f /home/git/.ssh/id_ed25519 -P '' && \
mv /home/git/.ssh/id_ed25519.pub /home/git/.ssh/authorized_keys && \
mkdir /home/git/test.git && \
git --bare init /home/git/test.git"
VOLUME ["/home/git/.ssh", "/home/git/test.git/hooks"]
WORKDIR /home/git
CMD ["/usr/sbin/sshd", "-D"]
```

3. Create a test pre-receive script called `always_reject.sh`. This example script will reject all pushes, which is useful for locking a repository:

```
#!/usr/bin/env bash
```dockerfile
FROM gliderlabs/alpine:3.3
RUN \
apk add --no-cache git openssh bash && \
ssh-keygen -A && \
sed -i "s/#AuthorizedKeysFile/AuthorizedKeysFile/g" /etc/ssh/sshd_config && \
adduser git -D -G root -h /home/git -s /bin/bash && \
passwd -d git && \
su git -c "mkdir /home/git/.ssh && \
ssh-keygen -t ed25519 -f /home/git/.ssh/id_ed25519 -P '' && \
mv /home/git/.ssh/id_ed25519.pub /home/git/.ssh/authorized_keys && \
mkdir /home/git/test.git && \
git --bare init /home/git/test.git"

VOLUME ["/home/git/.ssh", "/home/git/test.git/hooks"]
WORKDIR /home/git

CMD ["/usr/sbin/sshd", "-D"]
```

3. Create a test pre-receive script called `always_reject.sh`. This example script will reject all pushes, which is useful for locking a repository:

```shell
#!/usr/bin/env bash

echo "error: rejecting all pushes"
exit 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ If you don't have private mode enabled, the migration script will have no effect

1. Connect to the administrative shell. For more information, see "[Accessing the administrative shell (SSH)](/enterprise/admin/installation/accessing-the-administrative-shell-ssh)."
2. Navigate to the `/data/github/current` directory.
```
```shell
cd /data/github/current
```
3. Run the migration command.
```
```shell
sudo bin/safe-ruby lib/github/transitions/20191210220630_convert_public_ghes_repos_to_internal.rb --verbose -w | tee -a /tmp/convert_public_ghes_repos_to_internal.log
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Name | Type | Description

This example uses a form on a web page with a button that triggers the `POST` request for a user account:

```
```html
<form action="https://github.com/settings/apps/new?state=abc123" method="post">
Create a GitHub App Manifest: <input type="text" name="manifest" id="manifest"><br>
<input type="submit" value="Submit">
Expand Down Expand Up @@ -111,7 +111,7 @@ This example uses a form on a web page with a button that triggers the `POST` re
```
This example uses a form on a web page with a button that triggers the `POST` request for an organization account. Replace `ORGANIZATION` with the name of the organization account where you want to create the app.

```
```html
<form action="https://github.com/organizations/<em>ORGANIZATION</em>/settings/apps/new?state=abc123" method="post">
Create a GitHub App Manifest: <input type="text" name="manifest" id="manifest"><br>
<input type="submit" value="Submit">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ To push to a repository, your app must have write permissions for "Repository co

In order to commit files, Git must know which [username](/articles/setting-your-username-in-git/) and [email](/articles/setting-your-commit-email-address-in-git/) to associate with the commit. Add two more environment variables in your `.env` file to store the name (`GITHUB_APP_USER_NAME`) and email (`GITHUB_APP_USER_EMAIL`) settings. Your name can be the name of your app and the email can be any email you'd like for this example. For example:

```
```ini
GITHUB_APP_USER_NAME=Octoapp
GITHUB_APP_USER_EMAIL[email protected]
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Name | Type | Description

By default, the response takes the following form. The response parameters `expires_in`, `refresh_token`, and `refresh_token_expires_in` are only returned when you enable the beta for expiring user-to-server access tokens.

```
```json
{
"access_token": "e72e16c7e42f292c6912e7710c838347ae178b4a",
"expires_in": "28800",
Expand Down
4 changes: 2 additions & 2 deletions content/developers/overview/secret-scanning.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Create a public, internet accessible HTTP endpoint at the URL you provided to us

##### Example POST sent to your endpoint

```
```http
POST / HTTP/1.1
Host: HOST
Accept: */*
Expand Down Expand Up @@ -95,7 +95,7 @@ Assuming you receive the following message, the code snippets below demonstrate
The code also assumes you've set an environment variable called `GITHUB_PRODUCTION_TOKEN` with a generated PAT (https://github.com/settings/tokens). The token does not need any permissions set.

**Sample message sent to verify endpoint**
```
```http
POST / HTTP/1.1
Host: HOST
Accept: */*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You can add YAML frontmatter to each issue template to pre-fill the issue title,

Here is example YAML front matter.

```
```yaml
---
name: Tracking issue
about: Use this template for tracking new features.
Expand Down
Loading

0 comments on commit d9167f1

Please sign in to comment.