Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.

Commit

Permalink
fix: pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
arantespp committed Sep 24, 2021
1 parent ea8cd16 commit 0b266c4
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ webhooks.on(
);

webhooks.on(['pull_request.closed'], async ({ payload }) => {
if (!getPipelines().includes('closed-pr')) {
if (!getPipelines().includes('pr')) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/deploy/cicd/pipelines.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import * as pipelinesModule from './pipelines';

test('pipelines', () => {
expect(pipelinesModule.pipelines).toMatchObject(
expect.arrayContaining(['pr', 'main', 'tag', 'closed-pr']),
expect.arrayContaining(['pr', 'main', 'tag']),
);
});
4 changes: 2 additions & 2 deletions packages/cli/src/deploy/cicd/pipelines.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export const pipelines = ['pr', 'closed-pr', 'main', 'tag'] as const;
export const pipelines = ['pr', 'main', 'tag'] as const;

export type Pipelines = typeof pipelines;

export type Pipeline = Pipelines[number];

const executeCommandFile = (pipeline: Pipeline) =>
const executeCommandFile = (pipeline: Pipeline | 'closed-pr') =>
`chmod +x ./cicd/commands/${pipeline} && ./cicd/commands/${pipeline}`;

export const getPrCommands = ({ branch }: { branch: string }) => [
Expand Down
26 changes: 13 additions & 13 deletions packages/cli/src/deploy/staticApp/command.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,22 +117,9 @@ describe('should set cloudfront', () => {

test('cloudfront must be true', () => {
const options = [
{
acm: 'some string',
},
{
acm: faker.random.word(),
aliases: [faker.random.word()],
},
{
cloudfront: true,
},
{
csp: {},
},
{
gtmId: faker.random.word(),
},
];

return expect(testHelper(options, true)).resolves.toBeTruthy();
Expand All @@ -152,6 +139,19 @@ describe('should set cloudfront', () => {
{
spa: true,
},
{
csp: {},
},
{
gtmId: faker.random.word(),
},
{
acm: 'some string',
},
{
acm: faker.random.word(),
aliases: [faker.random.word()],
},
];

return expect(testHelper(options, false)).resolves.toBeTruthy();
Expand Down
9 changes: 0 additions & 9 deletions packages/cli/src/deploy/staticApp/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,6 @@ export const deployStaticAppCommand: CommandModule<
*/
.middleware(() => {
AWS.config.region = CLOUDFRONT_REGION;
})
.middleware((argv: any) => {
const { acm, aliases, csp, gtmId } = argv;

const someDefined = [acm, aliases, csp, gtmId].some((value) => !!value);

if (someDefined) {
argv.cloudfront = true;
}
}),
handler: ({ destroy, ...rest }) => {
if (destroy) {
Expand Down

0 comments on commit 0b266c4

Please sign in to comment.