mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 20:49:53 +08:00
chore: use single update status of diff action
This commit is contained in:
parent
4dfa7ddf5e
commit
2116659f52
@ -77,6 +77,16 @@ jobs:
|
|||||||
const mergedStatus = diffPassed ? 'success' : hasDiffFailed ? 'failure' : 'pending';
|
const mergedStatus = diffPassed ? 'success' : hasDiffFailed ? 'failure' : 'pending';
|
||||||
console.log('Status:', mergedStatus);
|
console.log('Status:', mergedStatus);
|
||||||
|
|
||||||
|
const { data: currentStatuses } = await github.rest.repos.listCommitStatusesForRef({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
ref: prHeadSha,
|
||||||
|
});
|
||||||
|
|
||||||
|
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({
|
await github.rest.repos.createCommitStatus({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
@ -85,6 +95,7 @@ jobs:
|
|||||||
context: 'Visual Regression Diff Wait Approve',
|
context: 'Visual Regression Diff Wait Approve',
|
||||||
description: diffPassed ? 'Visual diff is acceptable' : 'Visual diff is not pass',
|
description: diffPassed ? 'Visual diff is acceptable' : 'Visual diff is not pass',
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (hasDiffSuccess || (hasDiffFailed && hasMemberApprove)) {
|
if (hasDiffSuccess || (hasDiffFailed && hasMemberApprove)) {
|
||||||
return 'success';
|
return 'success';
|
||||||
|
Loading…
Reference in New Issue
Block a user