fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
a3b009dd4
master
1name : Auto-Label PRs 2 3on : 4pull_request_target : 5types : [ opened , synchronize ] 6 7jobs : 8label-and-milestone : 9runs-on : ubuntu-latest 10steps : 11- name : Set label and milestone 12id : set-label-milestone 13uses : actions/github-script@d746ffe35508b1917358783b479e04febd2b8f71 # v9.0.0, build_tools/update-dependencies.sh 14with : 15script : | 16 const completionsLabel = 'completions'; 17 18 // Get changed files in the pull request 19 const prNumber = context.payload.pull_request.number; 20 const { data: files } = await github.rest.pulls.listFiles({ 21 owner: context.repo.owner, 22 repo: context.repo.repo, 23 pull_number: prNumber, 24 }); 25 26 // Check if any file matches /share/completions/*.fish and no change is outside of /share/ 27 const completionsRegex = new RegExp('^share/completions/.*\.fish'); 28 const isCompletions = files.some(file => completionsRegex.test(file.filename)) 29 && files.every(file => file.filename.startsWith('share/')); 30 31 if (isCompletions) { 32 // Add label to PR 33 await github.rest.issues.addLabels({ 34 owner: context.repo.owner, 35 repo: context.repo.repo, 36 issue_number: prNumber, 37 labels: [completionsLabel], 38 }); 39 console.log(`PR ${prNumber} assigned label "${completionsLabel}"`); 40 }