Skip to content

Commit 0e583a6

Browse files
authored
Notes Update
1 parent 826c0b2 commit 0e583a6

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

Learning-notes/Readme.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,4 +308,62 @@ You can add self-hosted runners at various levels in the management hierarchy:
308308
- Enterprise-level runners can be assigned to multiple organizations in an enterprise account.
309309

310310
To set up self-hosted, you need to add a runner and install the **GitHub Actions Runner** to connect the external compute to the self-hosted runner.
311-
After installing the GitHub Actions Runner, ensure **port 443** is open in your outbound rules to allow secure communication between the runner and GitHub.
311+
After installing the GitHub Actions Runner, ensure **port 443** is open in your outbound rules to allow secure communication between the runner and GitHub.
312+
313+
#### Workflow Commands Summary
314+
315+
Workflow commands in GitHub Actions let you interact with the runner machine during a workflow, performing tasks like setting environment variables, modifying the system PATH, sending debug messages, or sharing data between steps/jobs.
316+
317+
- Set Environment Variables
318+
Add variables for subsequent steps using $GITHUB_ENV:
319+
320+
```yaml
321+
steps:
322+
- name: Set environment variable
323+
run: echo "ACTION_ENV=production" >> $GITHUB_ENV
324+
```
325+
326+
- Add to System PATH
327+
Append a directory to the PATH variable using $GITHUB_PATH:
328+
329+
```yaml
330+
steps:
331+
- name: Add directory to PATH
332+
run: echo "/path/to/dir" >> $GITHUB_PATH
333+
```
334+
335+
- Set Output Parameters
336+
Share data between steps or jobs using $GITHUB_OUTPUT:
337+
338+
```yaml
339+
steps:
340+
- name: Set output
341+
id: example_step
342+
run: echo "result=output_value" >> $GITHUB_OUTPUT
343+
- name: Use output
344+
run: echo "The output was ${{ steps.example_step.outputs.result }}"
345+
```
346+
347+
- Create Debug Messages
348+
Send debug logs visible only in debug mode:
349+
350+
```yaml
351+
steps:
352+
- name: Debug message
353+
run: echo "::debug::This is a debug message"
354+
```
355+
356+
- Example: Add a directory to PATH and verify:
357+
358+
```yaml
359+
steps:
360+
- name: Add directory to PATH
361+
run: echo "$GITHUB_WORKSPACE/my_scripts" >> $GITHUB_PATH
362+
- name: Check new PATH
363+
run: echo $PATH
364+
```
365+
366+
Key Points:
367+
368+
$GITHUB_ENV, $GITHUB_PATH, and $GITHUB_OUTPUT are special files for managing variables, PATH, and outputs.
369+
Use these commands to efficiently share data for the current workflow run or customize the runner environment during workflows.

0 commit comments

Comments
 (0)