Skip to content

Commit 9c71a09

Browse files
ci: emulate release for discord
1 parent 02d3bc9 commit 9c71a09

File tree

1 file changed

+16
-27
lines changed

1 file changed

+16
-27
lines changed

.github/workflows/release-announcement.yml

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,22 @@ jobs:
1313
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1414

1515
- name: Set Release Context
16-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
17-
id: set_release_context
18-
with:
19-
script: |
20-
const { stdout } = await exec.getExecOutput('gh release view --json body,tagName,url,name');
21-
const releaseData = JSON.parse(stdout);
22-
const getContext = () => {
23-
const release = context.payload.release || {
24-
body: releaseData.body,
25-
name: releaseData.name || releaseData.tagName,
26-
html_url: releaseData.url
27-
};
28-
29-
return {
30-
body: release.body,
31-
name: release.name,
32-
html_url: release.html_url
33-
};
34-
};
35-
36-
const payload = getContext();
37-
38-
core.setOutput('body', payload.body);
39-
core.setOutput('name', payload.name);
40-
core.setOutput('html_url', payload.html_url);
41-
42-
console.log("Emulated Context:", payload);
16+
run: |
17+
RELEASE_JSON=$(gh release view --json body,tagName,url,name)
18+
BODY=$(echo "$RELEASE_JSON" | jq -r .body)
19+
NAME=$(echo "$RELEASE_JSON" | jq -r .name)
20+
TAG=$(echo "$RELEASE_JSON" | jq -r .tagName)
21+
URL=$(echo "$RELEASE_JSON" | jq -r .url)
22+
23+
echo "{
24+
\"release\": {
25+
\"body\": $(echo "$RELEASE_JSON" | jq .body),
26+
\"name\": \"${NAME:-$TAG}\",
27+
\"html_url\": \"$URL\"
28+
}
29+
}" > $HOME/mock_event.json
30+
31+
echo "GITHUB_EVENT_PATH=$HOME/mock_event.json" >> $GITHUB_ENV
4332
env:
4433
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4534

0 commit comments

Comments
 (0)