You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: learn-pr/github/create-custom-github-actions/includes/create-custom-github-action.md
+14-19Lines changed: 14 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@ GitHub Actions is a powerful feature that helps you to go from code to cloud, al
2
2
3
3
## Types of GitHub actions
4
4
5
-

5
+
:::image type="content" source="../media/action-types.png" alt-text="Diagram that displays the three types of GitHub Actions; Docker, JavaScript, and composite run steps actions." border="false":::
6
6
7
7
Actions are individual tasks that you can use to customize your development workflows. You can create your own actions by writing custom code that interacts with your repository to perform custom tasks, or by using actions the GitHub community shares. Navigating through various actions, you'll notice that there are three different types of actions: _Docker container actions_, _JavaScript actions_, and _composite run steps actions_. Let's take a closer look at each action type.
8
8
@@ -137,7 +137,8 @@ jobs:
137
137
| **Test Before Publishing** | Validate the composite action in a test repository. |
Composite actions are a powerful way to simplify workflows by bundling multiple steps into a reusable unit. These actions allow you to define a sequence of commands or actions in a single `action.yml` file, making it easier to maintain and reuse logic across workflows.
141
142
142
143
## Benefits of Composite Actions:
143
144
- **Reusability** - Define actions once and use them in multiple workflows.
@@ -232,10 +233,8 @@ async function run() {
232
233
233
234
run();
234
235
```
235
-
**Explanation:**
236
-
Uses core.getInput() to get the CLI version input.
237
-
Runs a curl command to download and install the CLI.
238
-
Uses core.setFailed() to fail the workflow if the installation fails.
236
+
**Explanation:**
237
+
The JavaScript action uses `core.getInput()` to retrieve the CLI version specified as input. It then executes a `curl` command to download and install the CLI. If the installation process fails, the action uses `core.setFailed()` to mark the workflow as failed.
239
238
240
239
### Step 4: Test the Action Locally
241
240
Before using the action in a workflow, test it on a GitHub-hosted runner.
@@ -338,18 +337,19 @@ ACTIONS_RUNNER_DEBUG=true
338
337
339
338
### How to Set Secrets for Debugging
340
339
1. Go to your GitHub repository.
341
-
2. Navigate to Settings > Secrets and variables > Actions.
342
-
3.Add new secrets named:
343
-
. ACTIONS_STEP_DEBUG → true
344
-
. ACTIONS_RUNNER_DEBUG → true
340
+
2. Navigate to **Settings** > **Secrets and variables** > **Actions**.
341
+
3. Add new secrets with the following names and values:
342
+
- **ACTIONS_STEP_DEBUG**: `true`
343
+
- **ACTIONS_RUNNER_DEBUG**: `true`
344
+
345
345
346
346
### Inspect Workflow Logs
347
347
When a workflow fails, click on the failed job in the Actions tab. Expand each step to:
348
348
349
-
. View detailed logs
350
-
. Check standard output (stdout)
351
-
. See the exit code of scripts
352
-
. Identify unhandled exceptions
349
+
-View detailed logs
350
+
-Check standard output (stdout)
351
+
-See the exit code of scripts
352
+
-Identify unhandled exceptions
353
353
354
354
🔍 Example Log Output
355
355
```plaintext
@@ -379,11 +379,6 @@ try {
379
379
```
380
380
🔁 This ensures GitHub stops the workflow on error and provides readable logs.
0 commit comments