forked from bento-platform/katsu
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #158 from CanDIG/sonchau/uuid_with_fk
DIG-1355: Sonchau/UUID with fk
- Loading branch information
Showing
60 changed files
with
45,602 additions
and
22,841 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
async function getFileSha(fileName, github_ref, octokit, context) { | ||
const path = "chord_metadata_service/mohpackets/docs/" + fileName; | ||
const { data } = await octokit.repos.getContent({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
path, | ||
ref: github_ref, | ||
}); | ||
return data.sha; | ||
} | ||
|
||
async function commitAndPushChanges( | ||
fileName, | ||
github_ref, | ||
fs, | ||
octokit, | ||
context | ||
) { | ||
const repoPath = "chord_metadata_service/mohpackets/docs/"; | ||
const fileSha = await getFileSha(fileName, github_ref, octokit, context); | ||
|
||
// Read the content of the updated file | ||
const fileContent = fs.readFileSync(`./${repoPath}${fileName}`, "utf8"); | ||
|
||
// Commit and push changes | ||
await octokit.request( | ||
`PUT /repos/{owner}/{repo}/contents/${repoPath}{fileName}`, | ||
{ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
fileName, | ||
message: `Update ${fileName}`, | ||
content: Buffer.from(fileContent).toString("base64"), | ||
sha: fileSha, | ||
branch: github_ref, | ||
} | ||
); | ||
} | ||
|
||
module.exports = { | ||
commitAndPushChanges, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.