mirror of
https://github.com/strapi/strapi.git
synced 2025-08-07 08:16:35 +00:00
Merge pull request #12730 from strapi/chore/update-label-checker
Update label checker to use pr: instead of issue-type
This commit is contained in:
commit
50733c4f51
@ -29,7 +29,7 @@ test('Test missing source label', async () => {
|
||||
github.context = {
|
||||
payload: {
|
||||
pull_request: {
|
||||
labels: [{ name: 'issue-type: enhancement' }],
|
||||
labels: [{ name: 'pr: enhancement' }],
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -48,7 +48,7 @@ test('Test too many source label', async () => {
|
||||
github.context = {
|
||||
payload: {
|
||||
pull_request: {
|
||||
labels: [{ name: 'source: a' }, { name: 'source: b' }, { name: 'issue-type: enhancement' }],
|
||||
labels: [{ name: 'source: a' }, { name: 'source: b' }, { name: 'pr: enhancement' }],
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -63,7 +63,7 @@ test('Test too many source label', async () => {
|
||||
setFailed.mockRestore();
|
||||
});
|
||||
|
||||
test('Test missing issue-type label', async () => {
|
||||
test('Test missing pr label', async () => {
|
||||
github.context = {
|
||||
payload: {
|
||||
pull_request: {
|
||||
@ -77,16 +77,16 @@ test('Test missing issue-type label', async () => {
|
||||
await action();
|
||||
|
||||
expect(setFailed).toHaveBeenCalled();
|
||||
expect(setFailed.mock.calls[0][0]).toBe(`The PR must have one and only one 'issue-type:' label.`);
|
||||
expect(setFailed.mock.calls[0][0]).toBe(`The PR must have one and only one 'pr:' label.`);
|
||||
|
||||
setFailed.mockRestore();
|
||||
});
|
||||
|
||||
test('Test too many issue-type label', async () => {
|
||||
test('Test too many pr label', async () => {
|
||||
github.context = {
|
||||
payload: {
|
||||
pull_request: {
|
||||
labels: [{ name: 'issue-type: a' }, { name: 'issue-type: b' }, { name: 'source: core' }],
|
||||
labels: [{ name: 'pr: a' }, { name: 'pr: b' }, { name: 'source: core' }],
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -96,7 +96,7 @@ test('Test too many issue-type label', async () => {
|
||||
await action();
|
||||
|
||||
expect(setFailed).toHaveBeenCalled();
|
||||
expect(setFailed.mock.calls[0][0]).toBe(`The PR must have one and only one 'issue-type:' label.`);
|
||||
expect(setFailed.mock.calls[0][0]).toBe(`The PR must have one and only one 'pr:' label.`);
|
||||
|
||||
setFailed.mockRestore();
|
||||
});
|
||||
|
File diff suppressed because one or more lines are too long
4
.github/actions/check-pr-status/index.js
vendored
4
.github/actions/check-pr-status/index.js
vendored
@ -20,14 +20,14 @@ async function main() {
|
||||
}
|
||||
|
||||
const sourceLabelCount = labels.filter(label => label.name.startsWith('source: ')).length;
|
||||
const issueLabelCount = labels.filter(label => label.name.startsWith('issue-type: ')).length;
|
||||
const issueLabelCount = labels.filter(label => label.name.startsWith('pr: ')).length;
|
||||
|
||||
if (sourceLabelCount !== 1) {
|
||||
core.setFailed(`The PR must have one and only one 'source:' label.`);
|
||||
}
|
||||
|
||||
if (issueLabelCount !== 1) {
|
||||
core.setFailed(`The PR must have one and only one 'issue-type:' label.`);
|
||||
core.setFailed(`The PR must have one and only one 'pr:' label.`);
|
||||
}
|
||||
|
||||
// NOTE: to avoid manual work, this is commented until we can set the workflow to trigger on pull_request milestone changes.
|
||||
|
Loading…
x
Reference in New Issue
Block a user