Skip to content

Commit 1176cbc

Browse files
authored
Merge pull request #4 from saadmk11/use-subprocess
Add Option to Run Workflow Commands using Python Subprocess Module
2 parents 61ee007 + 29095e5 commit 1176cbc

2 files changed

Lines changed: 97 additions & 35 deletions

File tree

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ pip install github-action-utils
2727

2828
This section documents all the functions provided by `github-action-utils`. The functions in the package should be used inside a workflow run.
2929

30-
### **`echo(message)`**
30+
**Note:** You can run the commands using python's `subprocess` module by using `use_subprocess` function parameter or `COMMANDS_USE_SUBPROCESS` environment variable.
31+
32+
### **`echo(message, use_subprocess=False)`**
3133

3234
Prints specified message to the action workflow console.
3335

@@ -42,7 +44,7 @@ Prints specified message to the action workflow console.
4244
# Hello World
4345
```
4446

45-
### **`debug(message)`**
47+
### **`debug(message, use_subprocess=False)`**
4648

4749
Prints colorful debug message to the action workflow console.
4850
GitHub Actions Docs: [debug](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-debug-message)
@@ -58,7 +60,7 @@ GitHub Actions Docs: [debug](https://docs.github.com/en/actions/using-workflows/
5860
# ::debug ::Hello World
5961
```
6062

61-
### **`notice(message, title=None, file=None, col=None, end_column=None, line=None, end_line=None)`**
63+
### **`notice(message, title=None, file=None, col=None, end_column=None, line=None, end_line=None, use_subprocess=False)`**
6264

6365
Prints colorful notice message to the action workflow console.
6466
GitHub Actions Docs: [notice](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-notice-message)
@@ -82,7 +84,7 @@ GitHub Actions Docs: [notice](https://docs.github.com/en/actions/using-workflows
8284
# ::notice title=test title,file=abc.py,col=1,endColumn=2,line=4,endLine=5::test message=
8385
```
8486

85-
### **`warning(message, title=None, file=None, col=None, end_column=None, line=None, end_line=None)`**
87+
### **`warning(message, title=None, file=None, col=None, end_column=None, line=None, end_line=None, use_subprocess=False)`**
8688

8789
Prints colorful warning message to the action workflow console.
8890
GitHub Actions Docs: [warning](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-warning-message)
@@ -106,7 +108,7 @@ GitHub Actions Docs: [warning](https://docs.github.com/en/actions/using-workflow
106108
# ::warning title=test title,file=abc.py,col=1,endColumn=2,line=4,endLine=5::test message
107109
```
108110

109-
### **`error(message, title=None, file=None, col=None, end_column=None, line=None, end_line=None)`**
111+
### **`error(message, title=None, file=None, col=None, end_column=None, line=None, end_line=None, use_subprocess=False)`**
110112

111113
Prints colorful error message to the action workflow console.
112114
GitHub Actions Docs: [error](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-error-message)
@@ -130,7 +132,7 @@ GitHub Actions Docs: [error](https://docs.github.com/en/actions/using-workflows/
130132
# ::error title=test title,file=abc.py,col=1,endColumn=2,line=4,endLine=5::test message
131133
```
132134

133-
### **`set_output(name, value)`**
135+
### **`set_output(name, value, use_subprocess=False)`**
134136

135137
Sets an action's output parameter for the running workflow.
136138
GitHub Actions Docs: [set_output](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter)
@@ -146,7 +148,7 @@ GitHub Actions Docs: [set_output](https://docs.github.com/en/actions/using-workf
146148
# ::set-output name=test_name::test_value
147149
```
148150

149-
### **`save_state(name, value)`**
151+
### **`save_state(name, value, use_subprocess=False)`**
150152

151153
Creates environment variable for sharing state with workflow's pre: or post: actions.
152154
GitHub Actions Docs: [save_state](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#sending-values-to-the-pre-and-post-actions)
@@ -192,7 +194,7 @@ Gets user input from running workflow.
192194
# my value
193195
```
194196

195-
### **`begin_stop_commands(token=None)` and `end_stop_commands(token)`**
197+
### **`begin_stop_commands(token=None, use_subprocess=False)` and `end_stop_commands(token, use_subprocess=False)`**
196198

197199
Stops processing any workflow commands. This special command allows you to log anything without accidentally running a workflow command.
198200
GitHub Actions Docs: [stop_commands](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#stopping-and-starting-workflow-commands)
@@ -224,7 +226,7 @@ GitHub Actions Docs: [stop_commands](https://docs.github.com/en/actions/using-wo
224226
# ::my_token::
225227
```
226228

227-
### **`start_group(title)` and `end_group()`**
229+
### **`start_group(title, use_subprocess=False)` and `end_group(use_subprocess=False)`**
228230

229231
Creates an expandable group in the workflow log.
230232
GitHub Actions Docs: [group](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines)
@@ -256,7 +258,7 @@ GitHub Actions Docs: [group](https://docs.github.com/en/actions/using-workflows/
256258
# ::endgroup::
257259
```
258260

259-
### **`add_mask(value)`**
261+
### **`add_mask(value, use_subprocess=False)`**
260262

261263
Masking a value prevents a string or variable from being printed in the workflow console.
262264
GitHub Actions Docs: [add_mask](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#masking-a-value-in-log)

0 commit comments

Comments
 (0)