Skip to content

Commit 56e88da

Browse files
committed
modified: .github/actions/recent-posts/action.yml
- Added outputs section. modified: .github/actions/recent-posts/main.py - Appending `json_string` to GITHUB_OUTPUT environment variable/file. modified: .github/workflows/recent-posts.yml - Echoing the resulting output from the action.
1 parent a1f4542 commit 56e88da

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

.github/actions/recent-posts/action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ description: "Get the most recent blog post metadata."
44
runs:
55
using: "docker"
66
image: "Dockerfile"
7+
8+
outputs:
9+
result:
10+
description: "The most recent blog post's metadata."

.github/actions/recent-posts/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,7 @@ class Feed(BaseXmlModel, tag="feed", nsmap=NSMAP, search_mode="ordered"):
4343
console = Console()
4444
model = Feed.from_xml(source=xml)
4545
json_string = model.model_dump_json()
46-
environ["GITHUB_OUTPUT"] = json_string
46+
with open(environ["GITHUB_OUTPUT"], mode="a") as f:
47+
f.write(f"result={json_string}")
48+
4749
print(environ["GITHUB_OUTPUT"])

.github/workflows/recent-posts.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ jobs:
77
steps:
88
- name: Recent post action
99
id: recent-post
10-
uses: "it176131/it176131.github.io/.github/actions/recent-posts@v1"
10+
uses: "it176131/it176131.github.io/.github/actions/recent-posts@v1"
11+
- name: Get the result
12+
run: echo ${{ steps.recent-post.outputs.result }}

0 commit comments

Comments
 (0)