@@ -76,12 +76,44 @@ jobs:
7676 if : steps.command-extractor.outputs.result == 'fantomas'
7777 id : fantomas
7878 run : dotnet fantomas . -r
79- - name : Process fantomas command
79+ - name : Process xlf command
8080 if : steps.command-extractor.outputs.result == 'xlf'
8181 id : xlf
8282 run : dotnet build src/Compiler /t:UpdateXlf
83+ - name : Process ilverify command
84+ if : steps.command-extractor.outputs.result == 'ilverify'
85+ id : ilverify
86+ env :
87+ TEST_UPDATE_BSL : 1
88+ run : |
89+ # Store the list of baseline files before running the script
90+ BASELINE_FILES_BEFORE=$(ls -la tests/ILVerify/*.bsl)
91+
92+ # Run the ilverify script with TEST_UPDATE_BSL=1
93+ pwsh tests/ILVerify/ilverify.ps1
94+
95+ # Calculate the changes per file
96+ echo "Checking for changes in baseline files..."
97+ FILES_CHANGED=0
98+ CHANGES_OUTPUT=""
99+
100+ for file in tests/ILVerify/*.bsl; do
101+ if git diff --quiet "$file"; then
102+ continue
103+ else
104+ FILES_CHANGED=$((FILES_CHANGED + 1))
105+ LINES_CHANGED=$(git diff --numstat "$file" | awk '{print $1 + $2}')
106+ CHANGES_OUTPUT="${CHANGES_OUTPUT}${file}: ${LINES_CHANGED} lines changed\n"
107+ fi
108+ done
109+
110+ if [ $FILES_CHANGED -eq 0 ]; then
111+ echo "result=The ilverify command ran and did not modify any baseline." >> $GITHUB_OUTPUT
112+ else
113+ echo "result=The ilverify command ran and triggered the following number of changes per file:\n${CHANGES_OUTPUT}" >> $GITHUB_OUTPUT
114+ fi
83115 - name : Commit and push changes
84- if : steps.fantomas.outcome == 'success' || steps.xlf.outcome == 'success'
116+ if : steps.fantomas.outcome == 'success' || steps.xlf.outcome == 'success' || steps.ilverify.outcome == 'success'
85117 run : |
86118 git config --local user.name "github-actions[bot]"
87119 git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
@@ -90,16 +122,18 @@ jobs:
90122 Co-authored-by: ${{ github.event.comment.user.login }} <${{ github.event.comment.user.id }}+${{ github.event.comment.user.login }}@users.noreply.github.com>'
91123 git push
92124 - name : Post command comment
93- if : steps.fantomas.outcome == 'success' || steps.xlf.outcome == 'success'
125+ if : steps.fantomas.outcome == 'success' || steps.xlf.outcome == 'success' || steps.ilverify.outcome == 'success'
94126 uses : actions/github-script@v3
95127 with :
96128 script : |
97129 // Probably, there's more universal way of getting outputs, but my gh-actions-fu is not that good.
98130 var output = ""
99131 if ("${{steps.command-extractor.outputs.result}}" == 'fantomas') {
100132 output = "${{steps.fantomas.outputs.result}}"
101- } else if("${{steps.command-extractor.outputs.result}}" == 'xlf') {
133+ } else if ("${{steps.command-extractor.outputs.result}}" == 'xlf') {
102134 output = "${{steps.xlf.outputs.result}}"
135+ } else if ("${{steps.command-extractor.outputs.result}}" == 'ilverify') {
136+ output = "${{steps.ilverify.outputs.result}}"
103137 }
104138 const body = `Ran ${{ steps.command-extractor.outputs.result }}: https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${process.env.GITHUB_RUN_ID}\n${output}`;
105139 await github.issues.createComment({
0 commit comments