Skip to content

Commit 200ee9a

Browse files
authored
Update README.md
1 parent aa416d0 commit 200ee9a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@ When the Docker Container Action runs, it first checks if the specified image ex
4242
This action is commonly used inside a composite action. For example, if the composite action is defined in the `github/example` repository, you could use the Docker Container Action in a step with the following syntax:
4343

4444
```yml
45-
- name: Update Action env variables
45+
# This step is required because GitHub Actions doesn't set GITHUB_ACTION_REPOSITORY nor GITHUB_ACTION_REF properly :(
46+
- id: action
4647
run: |
47-
if [[ $GITHUB_ACTION_PATH == /home/runner/work/_actions/* ]]; then
48-
echo "GITHUB_ACTION_REPOSITORY=$(jq -jn 'env.GITHUB_ACTION_PATH | split("/") | .[5:7] | join("/")')" >> $GITHUB_ENV
49-
echo "GITHUB_ACTION_REF=$(jq -jn 'env.GITHUB_ACTION_PATH | split("/") | .[7:] | join("/")')" >> $GITHUB_ENV
48+
if [[ $GITHUB_ACTION_PATH == */_actions/* ]]; then
49+
echo "repository=$(echo ${GITHUB_ACTION_PATH#*/_actions/} | cut -d/ -f1-2)" >> $GITHUB_OUTPUT
50+
echo "ref=$(echo ${GITHUB_ACTION_PATH#*/_actions/} | cut -d/ -f3)" >> $GITHUB_OUTPUT
5051
else
51-
echo "GITHUB_ACTION_REPOSITORY=$GITHUB_REPOSITORY" >> $GITHUB_ENV
52-
echo "GITHUB_ACTION_REF=$GITHUB_SHA" >> $GITHUB_ENV
52+
echo "repository=$GITHUB_REPOSITORY" >> $GITHUB_OUTPUT
53+
echo "ref=$GITHUB_SHA" >> $GITHUB_OUTPUT
5354
fi
5455
shell: bash
5556
- name: Run Docker container

0 commit comments

Comments
 (0)