Skip to content

Commit

Permalink
fix(notify-pipeline-complete): no longer set deployment status (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
danadajian authored May 13, 2022
1 parent 52c9f65 commit 3a936ab
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 98 deletions.
75 changes: 6 additions & 69 deletions dist/101.index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/101.index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 8 additions & 17 deletions src/helpers/notify-pipeline-complete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { DEFAULT_PIPELINE_DESCRIPTION, DEFAULT_PIPELINE_STATUS, PRODUCTION_ENVIRONMENT } from '../constants';
import { DEFAULT_PIPELINE_DESCRIPTION, DEFAULT_PIPELINE_STATUS } from '../constants';
import { context as githubContext } from '@actions/github';
import { map } from 'bluebird';
import { octokit } from '../octokit';
import { setDeploymentStatus } from './set-deployment-status';

export class NotifyPipelineComplete {
context?: string;
Expand All @@ -34,22 +33,14 @@ export const notifyPipelineComplete = async ({
...githubContext.repo
});
const commitHashes = data.map(pullRequest => pullRequest.head.sha);
return Promise.all([
map(commitHashes, async sha =>
octokit.repos.createCommitStatus({
sha,
context,
state: 'success',
description,
target_url,
...githubContext.repo
})
),
setDeploymentStatus({
description: DEFAULT_PIPELINE_DESCRIPTION,
environment: PRODUCTION_ENVIRONMENT,
return map(commitHashes, async sha =>
octokit.repos.createCommitStatus({
sha,
context,
state: 'success',
description,
target_url,
...githubContext.repo
})
]);
);
};
12 changes: 1 addition & 11 deletions test/helpers/notify-pipeline-complete.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { DEFAULT_PIPELINE_DESCRIPTION, DEFAULT_PIPELINE_STATUS, PRODUCTION_ENVIRONMENT } from '../../src/constants';
import { DEFAULT_PIPELINE_STATUS } from '../../src/constants';
import { Mocktokit } from '../types';
import { context } from '@actions/github';
import { notifyPipelineComplete } from '../../src/helpers/notify-pipeline-complete';
import { octokit } from '../../src/octokit';
import { setDeploymentStatus } from '../../src/helpers/set-deployment-status';

jest.mock('@actions/core');
jest.mock('@actions/github', () => ({
Expand Down Expand Up @@ -72,13 +71,4 @@ describe('setOpenPullRequestStatus', () => {
...context.repo
});
});

it('should call setDeploymentStatus with correct params', () => {
expect(setDeploymentStatus).toHaveBeenCalledWith({
state: 'success',
environment: PRODUCTION_ENVIRONMENT,
description: DEFAULT_PIPELINE_DESCRIPTION,
...context.repo
});
});
});

0 comments on commit 3a936ab

Please sign in to comment.