Skip to content
This repository was archived by the owner on Mar 31, 2025. It is now read-only.

Support AWS' Github Integration (Version 2) #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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