{"size": 498, "ext": "js", "max_stars_repo_path": "src/lib/utils.js", "max_stars_repo_name": "tarkhandelwal/github-ci-bot", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/lib/utils.js", "max_issues_repo_name": "tarkhandelwal/github-ci-bot", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/lib/utils.js", "max_forks_repo_name": "tarkhandelwal/github-ci-bot", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.9, "max_line_length": 72, "alphanum_fraction": 0.6626506024}
const parser = require("git-diff-parser");
const fetch = require("node-fetch");

async function getChangedFiles(context) {
    let changed_files = new Set()

    const response = await fetch(context.payload.pull_request.diff_url);
    const diff = parser(await response.text());
    for (let commit of diff.commits) {
        for (let file of commit.files) {
            changed_files.add(file.name.toString())
        }
    }

    return changed_files;
}

module.exports = {
    getChangedFiles
};