List all files changed in a pull request in Git/GitHub

前端 未结 6 1724
执念已碎
执念已碎 2020-12-29 04:58

Is there a way (from the command line) to list the names of all files changed in a PR in Git/GitHub? This would be used to find what tests need to be run in a Travis CI buil

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-29 05:36

    Chrome console...

    Note: This will break if Github changes the tags/classes/IDs in the page.

    const fileElems = document.querySelectorAll('#files div.file-info a.link-gray-dark');
    const filePaths = [];
    
    for (let a of fileElems) {
        filePaths.push(a.title);
    }
    
    const filePathsStr = filePaths.join('\n');
    console.log(filePathsStr);
    copy(filePathsStr);
    console.log('Copied to the clipboard as well 

提交回复
热议问题