Skip to content

Commit 6581566

Browse files
authored
优化工作流逻辑
1 parent c243f94 commit 6581566

1 file changed

Lines changed: 13 additions & 23 deletions

File tree

.github/workflows/pr-preview.yml

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -118,29 +118,6 @@ jobs:
118118
issue_number: context.issue.number,
119119
name: "preview/watch"
120120
});
121-
preview-watch:
122-
if: >-
123-
${{
124-
!github.event.repository.fork &&
125-
github.event_name == 'issue_comment' &&
126-
github.event.issue.pull_request &&
127-
github.event.comment.body == '/preview watch' &&
128-
contains('OWNER,MEMBER', github.event.comment.author_association)
129-
}}
130-
runs-on: ubuntu-latest
131-
permissions:
132-
pull-requests: write
133-
steps:
134-
- name: Add Label (preview/watch)
135-
uses: actions/github-script@v8
136-
with:
137-
script: |
138-
github.rest.issues.addLabels({
139-
owner: context.repo.owner,
140-
repo: context.repo.repo,
141-
issue_number: context.issue.number,
142-
labels: ["preview/watch"]
143-
});
144121
preview-create-init:
145122
if: >-
146123
${{
@@ -160,6 +137,7 @@ jobs:
160137
runs-on: ubuntu-latest
161138
permissions:
162139
checks: write
140+
pull-requests: write
163141
outputs:
164142
sha: ${{ steps.init.outputs.sha }}
165143
domain: ${{ steps.init.outputs.domain }}
@@ -195,6 +173,18 @@ jobs:
195173
}
196174
});
197175
core.setOutput('check-id', check.id);
176+
- if: ${{ github.event_name == 'issue_comment' && github.event.comment.body == '/preview watch' }}
177+
name: Add Label (preview/watch)
178+
continue-on-error: true
179+
uses: actions/github-script@v8
180+
with:
181+
script: |
182+
github.rest.issues.addLabels({
183+
owner: context.repo.owner,
184+
repo: context.repo.repo,
185+
issue_number: context.issue.number,
186+
labels: ["preview/watch"]
187+
});
198188
preview-create-build:
199189
needs: preview-create-init
200190
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)