Skip to content

Commit

Permalink
github action Setting environment variables by Python
Browse files Browse the repository at this point in the history
  • Loading branch information
copdips committed Oct 4, 2023
1 parent 4e13057 commit 40b7d1c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions _posts/2023/2023-09-19-github-actions-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ gallery:
title: ''
---

## Setting environment variables by Python

Same approach applies to other languages:

```yaml
- name: Create new env vars by Python
shell: python
run: |
import os
with open(os.environ["GITHUB_ENV"], "a") as f:
f.write("ENV_VAR_1=value_1\nENV_VAR_2=value_2\n")
```
## Parsing variables
### Parsing variables with object type
Expand Down

0 comments on commit 40b7d1c

Please sign in to comment.