Skip to content

Commit eabe2e4

Browse files
authored
Meta: Fix publish-pr.yml
The { total_count, artifacts } object from `listWorkflowRunArtifacts` is under `data`.
1 parent 82cc31c commit eabe2e4

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

.github/workflows/publish-pr.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: Publish PR
2+
run-name: ${{ github.workflow_run.display_title }}
23

34
on:
45
workflow_run:
@@ -15,7 +16,6 @@ jobs:
1516
github.event.workflow_run.conclusion == 'success'
1617
}}
1718
steps:
18-
- uses: actions/checkout@v4
1919
- name: Print event info
2020
uses: actions/github-script@v7
2121
with:
@@ -25,21 +25,13 @@ jobs:
2525
with:
2626
script: |
2727
const { owner, repo } = context.repo;
28-
const getKeys = (obj, until = Object.prototype) => {
29-
if (!obj || obj === until) return [];
30-
const ownKeys = Reflect.ownKeys(obj);
31-
const protoKeys = getKeys(Object.getPrototypeOf(obj), until);
32-
return new Set([...ownKeys, ...protoKeys]);
33-
};
34-
console.log('github', [...getKeys(github)]);
35-
console.log('github.rest', [...getKeys(github.rest)]);
36-
console.log('github.rest.actions', [...getKeys(github.rest.actions)]);
37-
const { total_count, artifacts } = await github.rest.actions.listWorkflowRunArtifacts({
28+
const listArtifactsResponse = await github.rest.actions.listWorkflowRunArtifacts({
3829
owner,
3930
repo,
4031
run_id: ${{ github.event.workflow_run.id }},
4132
name: 'result',
4233
});
34+
const { total_count, artifacts } = listArtifactsResponse.data;
4335
if (total_count !== 1) {
4436
const summary = artifacts?.map(artifact => {
4537
const { name, size_in_bytes, url } = artifact;

0 commit comments

Comments
 (0)