Skip to content

Commit

Permalink
Support AWS' Github Integration (Version 2). This closes jenseickmeye…
Browse files Browse the repository at this point in the history
  • Loading branch information
boginw committed Mar 23, 2022
1 parent b209b2f commit b0a8874
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,23 @@ exports.getPipelineExecution = async (pipelineName, executionId) => {
const artifactRevision = result.pipelineExecution.artifactRevisions[0];

const revisionURL = artifactRevision.revisionUrl;
const sha = artifactRevision.revisionId;

const pattern = /github.com\/(.+)\/(.+)\/commit\//;
const matches = pattern.exec(revisionURL);

return {
owner: matches[1],
repository: matches[2],
sha: sha
};
if (matches !== null) {
const sha = artifactRevision.revisionId;

return { owner: matches[1], repository: matches[2], sha };
}

const revisionParams = new URLSearchParams(new URL(revisionURL).search);
const fullRepository = revisionParams.get('FullRepositoryId');
const owner = fullRepository.split('/')[0];
const repository = fullRepository.split('/')[1];
const sha = revisionParams.get('Commit');

return { owner, repository, sha };
};

exports.postStatusToGitHub = async (owner, repository, sha, payload) => {
Expand Down

0 comments on commit b0a8874

Please sign in to comment.