Adds option to copy content from code blocks (#22829)
This commit is contained in:
@@ -48,13 +48,13 @@ Before you begin, you'll need to download Node.js and create a public {% data va
|
||||
|
||||
1. From your terminal, change directories into your new repository.
|
||||
|
||||
```shell
|
||||
```shell{:copy}
|
||||
cd hello-world-javascript-action
|
||||
```
|
||||
|
||||
1. From your terminal, initialize the directory with npm to generate a `package.json` file.
|
||||
|
||||
```shell
|
||||
```shell{:copy}
|
||||
npm init -y
|
||||
```
|
||||
|
||||
@@ -62,7 +62,7 @@ Before you begin, you'll need to download Node.js and create a public {% data va
|
||||
|
||||
Create a new file named `action.yml` in the `hello-world-javascript-action` directory with the following example code. For more information, see "[Metadata syntax for {% data variables.product.prodname_actions %}](/actions/creating-actions/metadata-syntax-for-github-actions)."
|
||||
|
||||
```yaml
|
||||
```yaml{:copy}
|
||||
name: 'Hello World'
|
||||
description: 'Greet someone and record the time'
|
||||
inputs:
|
||||
@@ -92,7 +92,7 @@ The toolkit offers more than the `core` and `github` packages. For more informat
|
||||
|
||||
At your terminal, install the actions toolkit `core` and `github` packages.
|
||||
|
||||
```shell
|
||||
```shell{:copy}
|
||||
npm install @actions/core
|
||||
npm install @actions/github
|
||||
```
|
||||
@@ -108,7 +108,7 @@ GitHub Actions provide context information about the webhook event, Git refs, wo
|
||||
Add a new file called `index.js`, with the following code.
|
||||
|
||||
{% raw %}
|
||||
```javascript
|
||||
```javascript{:copy}
|
||||
const core = require('@actions/core');
|
||||
const github = require('@actions/github');
|
||||
|
||||
@@ -174,7 +174,7 @@ From your terminal, commit your `action.yml`, `index.js`, `node_modules`, `packa
|
||||
|
||||
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)."
|
||||
|
||||
```shell
|
||||
```shell{:copy}
|
||||
git add action.yml index.js node_modules/* package.json package-lock.json README.md
|
||||
git commit -m "My first action is ready"
|
||||
git tag -a -m "My first action release" v1.1
|
||||
@@ -219,7 +219,7 @@ This example demonstrates how your new public action can be run from within an e
|
||||
Copy the following YAML into a new file at `.github/workflows/main.yml`, and update the `uses: octocat/hello-world-javascript-action@v1.1` line with your username and the name of the public repository you created above. You can also replace the `who-to-greet` input with your name.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
```yaml{:copy}
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
@@ -246,7 +246,7 @@ Copy the workflow code into a `.github/workflows/main.yml` file in your action's
|
||||
|
||||
{% raw %}
|
||||
**.github/workflows/main.yml**
|
||||
```yaml
|
||||
```yaml{:copy}
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
|
||||
Reference in New Issue
Block a user