mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 12:39:49 +08:00
chore: use single update status of diff action
This commit is contained in:
parent
4dfa7ddf5e
commit
2116659f52
@ -77,15 +77,26 @@ jobs:
|
|||||||
const mergedStatus = diffPassed ? 'success' : hasDiffFailed ? 'failure' : 'pending';
|
const mergedStatus = diffPassed ? 'success' : hasDiffFailed ? 'failure' : 'pending';
|
||||||
console.log('Status:', mergedStatus);
|
console.log('Status:', mergedStatus);
|
||||||
|
|
||||||
await github.rest.repos.createCommitStatus({
|
const { data: currentStatuses } = await github.rest.repos.listCommitStatusesForRef({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
sha: prHeadSha,
|
ref: prHeadSha,
|
||||||
state: mergedStatus,
|
|
||||||
context: 'Visual Regression Diff Wait Approve',
|
|
||||||
description: diffPassed ? 'Visual diff is acceptable' : 'Visual diff is not pass',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const currentStatus = currentStatuses.find(status => status.context === 'Visual Regression Diff Wait Approve');
|
||||||
|
if (currentStatus && currentStatus.state === mergedStatus) {
|
||||||
|
console.log('Status has not changed, no need to update:', currentStatus.state);
|
||||||
|
} else {
|
||||||
|
await github.rest.repos.createCommitStatus({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
sha: prHeadSha,
|
||||||
|
state: mergedStatus,
|
||||||
|
context: 'Visual Regression Diff Wait Approve',
|
||||||
|
description: diffPassed ? 'Visual diff is acceptable' : 'Visual diff is not pass',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (hasDiffSuccess || (hasDiffFailed && hasMemberApprove)) {
|
if (hasDiffSuccess || (hasDiffFailed && hasMemberApprove)) {
|
||||||
return 'success';
|
return 'success';
|
||||||
} else if (hasDiffFailed) {
|
} else if (hasDiffFailed) {
|
||||||
|
Loading…
Reference in New Issue
Block a user