Skip to content

Commit 8198dd4

Browse files
committed
Merge branch 'main' of github.com:github/docs-internal into make-developer-redirects-static
2 parents 0d7e04f + aee3e7a commit 8198dd4

79 files changed

Lines changed: 8457 additions & 24971 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/dry-run-sync-algolia-search-indices.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ jobs:
2121
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
2222
restore-keys: |
2323
${{ runner.os }}-node-
24-
- name: npm ci
24+
- name: Install dependencies
2525
run: npm ci
26+
- name: Run build scripts
27+
run: npm run build
2628
- name: (Dry run) sync indices
2729
env:
2830
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}

.github/workflows/sync-algolia-search-indices.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ jobs:
2424
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
2525
restore-keys: |
2626
${{ runner.os }}-node-
27-
- name: npm ci
27+
- name: Install dependencies
2828
run: npm ci
29+
- name: Run build scripts
30+
run: npm run build
2931
- name: sync indices
3032
env:
3133
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.algolia-cache
2+
.search-cache
23
.DS_Store
34
.env
45
/node_modules/

content/actions/creating-actions/creating-a-docker-container-action.md

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Before you begin, you'll need to create a GitHub repository.
3939

4040
1. From your terminal, change directories into your new repository.
4141

42-
```shell
42+
```shell{:copy}
4343
cd hello-world-docker-action
4444
```
4545

@@ -48,7 +48,7 @@ Before you begin, you'll need to create a GitHub repository.
4848
In your new `hello-world-docker-action` directory, create a new `Dockerfile` file. For more information, see "[Dockerfile support for {% data variables.product.prodname_actions %}](/actions/creating-actions/dockerfile-support-for-github-actions)."
4949

5050
**Dockerfile**
51-
```dockerfile
51+
```dockerfile{:copy}
5252
# Container image that runs your code
5353
FROM alpine:3.10
5454
@@ -65,7 +65,7 @@ Create a new `action.yml` file in the `hello-world-docker-action` directory you
6565

6666
{% raw %}
6767
**action.yml**
68-
```yaml
68+
```yaml{:copy}
6969
# action.yml
7070
name: 'Hello World'
7171
description: 'Greet someone and record the time'
@@ -93,29 +93,28 @@ This metadata defines one `who-to-greet` input and one `time` output parameter.
9393

9494
You can choose any base Docker image and, therefore, any language for your action. The following shell script example uses the `who-to-greet` input variable to print "Hello [who-to-greet]" in the log file.
9595

96-
Next, the script gets the current time and sets it as an output variable that actions running later in a job can use. In order for {% data variables.product.prodname_dotcom %} to recognize output variables, you must use a workflow command in a specific syntax: `echo "::set-output name=<output name>::<value>"`. For more information, see "[Workflow commands for {% data variables.product.prodname_actions %}](/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter)."
96+
Next, the script gets the current time and sets it as an output variable that actions running later in a job can use. In order for {% data variables.product.prodname_dotcom %} to recognize output variables, you must use a workflow command in a specific syntax: `echo "::set-output name=<output name>::<value>"`. For more information, see "[Workflow commands for {% data variables.product.prodname_actions %}](/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter)."
9797

9898
1. Create a new `entrypoint.sh` file in the `hello-world-docker-action` directory.
9999

100-
1. Make your `entrypoint.sh` file executable:
101-
102-
```shell
103-
chmod +x entrypoint.sh
104-
```
105-
106100
1. Add the following code to your `entrypoint.sh` file.
107101

108102
**entrypoint.sh**
109-
```shell
103+
```shell{:copy}
110104
#!/bin/sh -l
111105
112106
echo "Hello $1"
113107
time=$(date)
114108
echo "::set-output name=time::$time"
115109
```
116-
117110
If `entrypoint.sh` executes without any errors, the action's status is set to `success`. You can also explicitly set exit codes in your action's code to provide an action's status. For more information, see "[Setting exit codes for actions](/actions/creating-actions/setting-exit-codes-for-actions)."
118111

112+
1. Make your `entrypoint.sh` file executable by running the following command on your system.
113+
114+
```shell{:copy}
115+
$ chmod +x entrypoint.sh
116+
```
117+
119118
### Creating a README
120119

121120
To let people know how to use your action, you can create a README file. A README is most helpful when you plan to share your action publicly, but is also a great way to remind you or your team how to use the action.
@@ -130,7 +129,7 @@ In your `hello-world-docker-action` directory, create a `README.md` file that sp
130129
- An example of how to use your action in a workflow.
131130

132131
**README.md**
133-
```markdown
132+
```markdown{:copy}
134133
# Hello world docker action
135134
136135
This action prints "Hello World" or "Hello" + the name of a person to greet to the log.
@@ -160,7 +159,7 @@ From your terminal, commit your `action.yml`, `entrypoint.sh`, `Dockerfile`, and
160159

161160
It's best practice to also add a version tag for releases of your action. For more information on versioning your action, see "[About actions](/actions/automating-your-workflow-with-github-actions/about-actions#using-release-management-for-actions)."
162161

163-
```shell
162+
```shell{:copy}
164163
git add action.yml entrypoint.sh Dockerfile README.md
165164
git commit -m "My first action is ready"
166165
git tag -a -m "My first action release" v1
@@ -175,11 +174,11 @@ Now you're ready to test your action out in a workflow. When an action is in a p
175174

176175
#### Example using a public action
177176

178-
The following workflow code uses the completed hello world action in the public [`actions/hello-world-docker-action`](https://github.com/actions/hello-world-docker-action) repository. Copy the following workflow example code into a `.github/workflows/main.yml` file, but replace the `actions/hello-world-docker-action` with your repository and action name. You can also replace the `who-to-greet` input with your name.
177+
The following workflow code uses the completed _hello world_ action in the public [`actions/hello-world-docker-action`](https://github.com/actions/hello-world-docker-action) repository. Copy the following workflow example code into a `.github/workflows/main.yml` file, but replace the `actions/hello-world-docker-action` with your repository and action name. You can also replace the `who-to-greet` input with your name. {% if currentVersion == "free-pro-team@latest" %}Public actions can be used even if they're not published to {% data variables.product.prodname_marketplace %}. For more information, see "[Publishing an action](/actions/creating-actions/publishing-actions-in-github-marketplace#publishing-an-action)." {% endif %}
179178

180179
{% raw %}
181180
**.github/workflows/main.yml**
182-
```yaml
181+
```yaml{:copy}
183182
on: [push]
184183
185184
jobs:
@@ -200,11 +199,11 @@ jobs:
200199

201200
#### Example using a private action
202201

203-
Copy the following example workflow code into a `.github/workflows/main.yml` file in your action's repository. You can also replace the `who-to-greet` input with your name.
202+
Copy the following example workflow code into a `.github/workflows/main.yml` file in your action's repository. You can also replace the `who-to-greet` input with your name. {% if currentVersion == "free-pro-team@latest" %}This private action can't be published to {% data variables.product.prodname_marketplace %}, and can only be used in this repository.{% endif %}
204203

205204
{% raw %}
206205
**.github/workflows/main.yml**
207-
```yaml
206+
```yaml{:copy}
208207
on: [push]
209208
210209
jobs:

content/actions/guides/about-service-containers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ You can use the `services` keyword to create service containers that are part of
4747
This example creates a service called `redis` in a job called `container-job`. The Docker host in this example is the `node:10.18-jessie` container.
4848

4949
{% raw %}
50-
```yaml
50+
```yaml{:copy}
5151
name: Redis container example
5252
on: push
5353
@@ -89,7 +89,7 @@ When you specify the Docker host port but not the container port, the container
8989
This example maps the service container `redis` port 6379 to the Docker host port 6379.
9090

9191
{% raw %}
92-
```yaml
92+
```yaml{:copy}
9393
name: Redis Service Example
9494
on: push
9595

content/actions/guides/building-and-testing-java-with-ant.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ To get started quickly, you can choose the preconfigured Ant template when you c
3838
You can also add this workflow manually by creating a new file in the `.github/workflows` directory of your repository.
3939

4040
{% raw %}
41-
```yaml
41+
```yaml{:copy}
4242
name: Java CI
4343
4444
on: [push]
@@ -79,7 +79,7 @@ The starter workflow will run the default target specified in your _build.xml_ f
7979
If you use different commands to build your project, or you want to run a different target, you can specify those. For example, you may want to run the `jar` target that's configured in your _build-ci.xml_ file.
8080

8181
{% raw %}
82-
```yaml
82+
```yaml{:copy}
8383
steps:
8484
- uses: actions/checkout@v2
8585
- uses: actions/setup-java@v1
@@ -97,7 +97,7 @@ After your build has succeeded and your tests have passed, you may want to uploa
9797
Ant will usually create output files like JARs, EARs, or WARs in the `build/jar` directory. You can upload the contents of that directory using the `upload-artifact` action.
9898

9999
{% raw %}
100-
```yaml
100+
```yaml{:copy}
101101
steps:
102102
- uses: actions/checkout@v2
103103
- uses: actions/setup-java@v1

content/actions/guides/building-and-testing-java-with-gradle.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ To get started quickly, you can choose the preconfigured Gradle template when yo
3838
You can also add this workflow manually by creating a new file in the `.github/workflows` directory of your repository.
3939

4040
{% raw %}
41-
```yaml
41+
```yaml{:copy}
4242
name: Java CI
4343
4444
on: [push]
@@ -79,7 +79,7 @@ The starter workflow will run the `build` task by default. In the default Gradle
7979
If you use different commands to build your project, or you want to use a different task, you can specify those. For example, you may want to run the `package` task that's configured in your _ci.gradle_ file.
8080

8181
{% raw %}
82-
```yaml
82+
```yaml{:copy}
8383
steps:
8484
- uses: actions/checkout@v2
8585
- uses: actions/setup-java@v1
@@ -95,7 +95,7 @@ steps:
9595
When using {% data variables.product.prodname_dotcom %}-hosted runners, you can cache your dependencies to speed up your workflow runs. After a successful run, your local Gradle package cache will be stored on GitHub Actions infrastructure. In future workflow runs, the cache will be restored so that dependencies don't need to be downloaded from remote package repositories. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>" and the [`cache` action](https://github.com/marketplace/actions/cache).
9696

9797
{% raw %}
98-
```yaml
98+
```yaml{:copy}
9999
steps:
100100
- uses: actions/checkout@v2
101101
- name: Set up JDK 1.8
@@ -122,7 +122,7 @@ After your build has succeeded and your tests have passed, you may want to uploa
122122
Gradle will usually create output files like JARs, EARs, or WARs in the `build/libs` directory. You can upload the contents of that directory using the `upload-artifact` action.
123123

124124
{% raw %}
125-
```yaml
125+
```yaml{:copy}
126126
steps:
127127
- uses: actions/checkout@v2
128128
- uses: actions/setup-java@v1

content/actions/guides/building-and-testing-java-with-maven.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ To get started quickly, you can choose the preconfigured Maven template when you
3838
You can also add this workflow manually by creating a new file in the `.github/workflows` directory of your repository.
3939

4040
{% raw %}
41-
```yaml
41+
```yaml{:copy}
4242
name: Java CI
4343
4444
on: [push]
@@ -79,7 +79,7 @@ The starter workflow will run the `package` target by default. In the default Ma
7979
If you use different commands to build your project, or you want to use a different target, you can specify those. For example, you may want to run the `verify` target that's configured in a _pom-ci.xml_ file.
8080

8181
{% raw %}
82-
```yaml
82+
```yaml{:copy}
8383
steps:
8484
- uses: actions/checkout@v2
8585
- uses: actions/setup-java@v1
@@ -95,7 +95,7 @@ steps:
9595
When using {% data variables.product.prodname_dotcom %}-hosted runners, you can cache your dependencies to speed up your workflow runs. After a successful run, your local Maven repository will be stored on GitHub Actions infrastructure. In future workflow runs, the cache will be restored so that dependencies don't need to be downloaded from remote Maven repositories. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>" and the [`cache` action](https://github.com/marketplace/actions/cache).
9696

9797
{% raw %}
98-
```yaml
98+
```yaml{:copy}
9999
steps:
100100
- uses: actions/checkout@v2
101101
- name: Set up JDK 1.8
@@ -122,7 +122,7 @@ After your build has succeeded and your tests have passed, you may want to uploa
122122
Maven will usually create output files like JARs, EARs, or WARs in the `target` directory. To upload those as artifacts, you can copy them into a new directory that contains artifacts to upload. For example, you can create a directory called `staging`. Then you can upload the contents of that directory using the `upload-artifact` action.
123123

124124
{% raw %}
125-
```yaml
125+
```yaml{:copy}
126126
steps:
127127
- uses: actions/checkout@v2
128128
- uses: actions/setup-java@v1

content/actions/guides/building-and-testing-nodejs.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ The template includes a matrix strategy that builds and tests your code with fou
7777
Each job can access the value defined in the matrix `node-version` array using the `matrix` context. The `setup-node` action uses the context as the `node-version` input. The `setup-node` action configures each job with a different Node.js version before building and testing code. For more information about matrix strategies and contexts, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix)" and "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."
7878

7979
{% raw %}
80-
```yaml
80+
```yaml{:copy}
8181
strategy:
8282
matrix:
8383
node-version: [10.x, 12.x, 14.x, 15.x]
@@ -93,7 +93,7 @@ steps:
9393

9494
Alternatively, you can build and test with exact Node.js versions.
9595

96-
```yaml
96+
```yaml{:copy}
9797
strategy:
9898
matrix:
9999
node-version: [8.16.2, 10.17.0]
@@ -102,7 +102,7 @@ strategy:
102102
Or, you can build and test using a single version of Node.js too.
103103

104104
{% raw %}
105-
```yaml
105+
```yaml{:copy}
106106
name: Node.js CI
107107
108108
on: [push]
@@ -136,7 +136,7 @@ When using {% data variables.product.prodname_dotcom %}-hosted runners, you can
136136

137137
This example installs the dependencies defined in the *package.json* file. For more information, see [`npm install`](https://docs.npmjs.com/cli/install).
138138

139-
```yaml
139+
```yaml{:copy}
140140
steps:
141141
- uses: actions/checkout@v2
142142
- name: Use Node.js
@@ -150,7 +150,7 @@ steps:
150150
Using `npm ci` installs the versions in the *package-lock.json* or *npm-shrinkwrap.json* file and prevents updates to the lock file. Using `npm ci` is generally faster than running `npm install`. For more information, see [`npm ci`](https://docs.npmjs.com/cli/ci.html) and "[Introducing `npm ci` for faster, more reliable builds](https://blog.npmjs.org/post/171556855892/introducing-npm-ci-for-faster-more-reliable)."
151151

152152
{% raw %}
153-
```yaml
153+
```yaml{:copy}
154154
steps:
155155
- uses: actions/checkout@v2
156156
- name: Use Node.js
@@ -166,7 +166,7 @@ steps:
166166

167167
This example installs the dependencies defined in the *package.json* file. For more information, see [`yarn install`](https://yarnpkg.com/en/docs/cli/install).
168168

169-
```yaml
169+
```yaml{:copy}
170170
steps:
171171
- uses: actions/checkout@v2
172172
- name: Use Node.js
@@ -179,7 +179,7 @@ steps:
179179

180180
Alternatively, you can pass `--frozen-lockfile` to install the versions in the *yarn.lock* file and prevent updates to the *yarn.lock* file.
181181

182-
```yaml
182+
```yaml{:copy}
183183
steps:
184184
- uses: actions/checkout@v2
185185
- name: Use Node.js
@@ -201,7 +201,7 @@ In the example below, the secret `NPM_TOKEN` stores the npm authentication token
201201
Before installing dependencies, use the `setup-node` action to create the *.npmrc* file. The action has two input parameters. The `node-version` parameter sets the Node.js version, and the `registry-url` parameter sets the default registry. If your package registry uses scopes, you must use the `scope` parameter. For more information, see [`npm-scope`](https://docs.npmjs.com/misc/scope).
202202

203203
{% raw %}
204-
```yaml
204+
```yaml{:copy}
205205
steps:
206206
- uses: actions/checkout@v2
207207
- name: Use Node.js
@@ -231,7 +231,7 @@ always-auth=true
231231
When using {% data variables.product.prodname_dotcom %}-hosted runners, you can cache dependencies using a unique key, and restore the dependencies when you run future workflows using the `cache` action. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>" and the [`cache` action](https://github.com/marketplace/actions/cache).
232232

233233
{% raw %}
234-
```yaml
234+
```yaml{:copy}
235235
steps:
236236
- uses: actions/checkout@v2
237237
- name: Use Node.js
@@ -256,7 +256,7 @@ steps:
256256

257257
You can use the same commands that you use locally to build and test your code. For example, if you run `npm run build` to run build steps defined in your *package.json* file and `npm test` to run your test suite, you would add those commands in your workflow file.
258258

259-
```yaml
259+
```yaml{:copy}
260260
steps:
261261
- uses: actions/checkout@v2
262262
- name: Use Node.js

0 commit comments

Comments
 (0)