Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
copdips committed Oct 6, 2023
1 parent f4094d2 commit 9af3080
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions _posts/2023/2023-09-19-github-actions-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ gallery:
Suppose we create a new branch named `new_branch`, and create a pull request (with id `123`) from the new branch `new_branch` to the `main` branch.
During the pipeline, we can see following predefined variables in different GIT events.

Check [here](https://copdips.com/2022/01/azure-pipeline-predefined-variables.html#variables-upon-git-events) for variables upon git event in Azure Pipelines.
Check [here](https://copdips.com/2022/01/azure-pipeline-predefined-variables.html#variables-upon-git-events) for variables upon git events in Azure Pipelines.
{: .notice--info}

{% raw %}
Expand Down Expand Up @@ -67,27 +67,27 @@ Same approach applies to other languages:
### Parsing variables with object type
Workflow :
{% raw %}
```yaml
- run: |
echo "github.event: ${{ github.event }}"
echo "github.event toJson: $GITHUB_EVENT"
env:
GITHUB_EVENT: ${{ toJson(github.event) }}
```
Output:

```bash
# output:
github.event: Object
github.event toJson: {
after: 9da8166fcc52c437871a2e903b3e200a35c09a1e,
base_ref: null,
before: 1448cfbf10fc149b7d200d0a0e15493f41cc8896,
...
}
```

{% endraw %}

{% raw %}`echo "github.event toJson: ${{ toJSON(github.event) }}"`{% endraw %} will [raise error](https://github.com/actions/runner/issues/1656#issuecomment-1030077729), must parse the variable to environment variable `$GITHUB_EVENT` at first. So when using `toJson` method to parse object type variable, it is recommended to send the value to an environment variable first.
{: .notice--warning}

Expand Down

0 comments on commit 9af3080

Please sign in to comment.