Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
rscohn2 committed Jun 13, 2024
1 parent 36fc348 commit bd9eb26
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions .github/scripts/domain-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,26 @@ function matchesPattern(domain, filePaths) {
return match;
}

function prFiles(github, context) {
const pr = context.payload.pull_request
async function prFiles(github, context) {
const pr = context.payload.pull_request;
if (!pr) {
return []
return [];
}
const prFiles = github.rest.pulls.listFiles({
const response = await github.rest.pulls.listFiles({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number
});
console.log("PR files: ", prFiles)
return prFiles
const prFiles = response.data.map(file => file.filename);
console.log("PR files: ", prFiles);
return prFiles;
}

module.exports = ({github, context}) => {
module.exports = async ({github, context}) => {
const domain = "blas";
const match = matchesPattern(domain, prFiles(github, context));
console.log("domain: ", domain, " Match: ", match)
const files = await prFiles(github, context);
const match = matchesPattern(domain, files);
console.log("domain: ", domain, " Match: ", match);
return match;
}

Expand Down

0 comments on commit bd9eb26

Please sign in to comment.