@@ -12,10 +12,12 @@ jobs:
1212 runs-on : ubuntu-latest
1313 steps :
1414 - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
15+ with :
16+ fetch-depth : 0
1517 - name : Determine changed files
1618 id : changed-files
1719 run : |
18- changedFiles=$(git diff --name-only --diff-filter=ACMR ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep acknowledgements.md$)
20+ changedFiles=$(git diff --name-only --diff-filter=ACMR ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep acknowledgements.md$ | xargs )
1921 echo "Changed files: ${changedFiles}"
2022 echo "files=${changedFiles}" >> "$GITHUB_OUTPUT"
2123 - name : Check modified acknowledgements files
2426 with :
2527 script : |
2628 const fs = require('fs')
27- const files = '${{ steps.changed-files.outputs.files }}'.trim().split(/\r?\n /)
28- const nameIdRegex = /\[(?<name>[^\]]+)\]\(https:\/\/github\.com\/(?<id>[^\)]+)\)/g
29+ const files = '${{ steps.changed-files.outputs.files }}'.trim().split(/\s+ /)
30+ const nameIdRegex = /\[(?<name>[^\]]+)\]\(https:\/\/github\.com\/(?<id>[^\)/ ]+)\)/g
2931 const contributorNames = new Map()
3032 for (file of files) {
3133 let lines = fs.readFileSync(file, {encoding: 'utf8'}).split(/\r?\n/)
@@ -35,15 +37,15 @@ jobs:
3537 }
3638 }
3739 }
38- let boolean hasMultipleNames = false
40+ let hasMultipleNames = false
3941 for (const [profile, names] of contributorNames) {
4042 if (names.size > 1) {
41- core.error(' Multiple names found for profile '" + profile + "': ' + Array.from(names).join(', '))
43+ core.error(" Multiple names found for profile '" + profile + "': " + Array.from(names).join(', '))
4244 hasMultipleNames = true
4345 }
4446 }
4547 if (hasMultipleNames) {
46- throw new Error('No selected name for profile: ' + profile )
48+ throw new Error('Multiple names detected. See log for details.' )
4749 }
4850
4951 function computeIfAbsent(map, key, valueSupplier) {
0 commit comments