From 44a163f2bcbb094f9be5ebe66addf56b6a5611d3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 May 2025 07:58:17 +0000 Subject: [PATCH 1/6] Initial plan for issue From 10d44e4b1b1550ca4fa500efe010b4f4cc3a7a1f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 May 2025 08:01:12 +0000 Subject: [PATCH 2/6] Add ILVerify command to commands.yml Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com> --- .github/workflows/commands.yml | 42 ++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/.github/workflows/commands.yml b/.github/workflows/commands.yml index 72fa71e6e9c..3886581ac08 100644 --- a/.github/workflows/commands.yml +++ b/.github/workflows/commands.yml @@ -76,12 +76,44 @@ jobs: if: steps.command-extractor.outputs.result == 'fantomas' id: fantomas run: dotnet fantomas . -r - - name: Process fantomas command + - name: Process xlf command if: steps.command-extractor.outputs.result == 'xlf' id: xlf run: dotnet build src/Compiler /t:UpdateXlf + - name: Process ilverify command + if: steps.command-extractor.outputs.result == 'ilverify' + id: ilverify + env: + TEST_UPDATE_BSL: 1 + run: | + # Store the list of baseline files before running the script + BASELINE_FILES_BEFORE=$(ls -la tests/ILVerify/*.bsl) + + # Run the ilverify script with TEST_UPDATE_BSL=1 + pwsh tests/ILVerify/ilverify.ps1 + + # Calculate the changes per file + echo "Checking for changes in baseline files..." + FILES_CHANGED=0 + CHANGES_OUTPUT="" + + for file in tests/ILVerify/*.bsl; do + if git diff --quiet "$file"; then + continue + else + FILES_CHANGED=$((FILES_CHANGED + 1)) + LINES_CHANGED=$(git diff --numstat "$file" | awk '{print $1 + $2}') + CHANGES_OUTPUT="${CHANGES_OUTPUT}${file}: ${LINES_CHANGED} lines changed\n" + fi + done + + if [ $FILES_CHANGED -eq 0 ]; then + echo "result=The ilverify command ran and did not modify any baseline." >> $GITHUB_OUTPUT + else + echo "result=The ilverify command ran and triggered the following number of changes per file:\n${CHANGES_OUTPUT}" >> $GITHUB_OUTPUT + fi - name: Commit and push changes - if: steps.fantomas.outcome == 'success' || steps.xlf.outcome == 'success' + if: steps.fantomas.outcome == 'success' || steps.xlf.outcome == 'success' || steps.ilverify.outcome == 'success' run: | git config --local user.name "github-actions[bot]" git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" @@ -90,7 +122,7 @@ jobs: Co-authored-by: ${{ github.event.comment.user.login }} <${{ github.event.comment.user.id }}+${{ github.event.comment.user.login }}@users.noreply.github.com>' git push - name: Post command comment - if: steps.fantomas.outcome == 'success' || steps.xlf.outcome == 'success' + if: steps.fantomas.outcome == 'success' || steps.xlf.outcome == 'success' || steps.ilverify.outcome == 'success' uses: actions/github-script@v3 with: script: | @@ -98,8 +130,10 @@ jobs: var output = "" if ("${{steps.command-extractor.outputs.result}}" == 'fantomas') { output = "${{steps.fantomas.outputs.result}}" - } else if("${{steps.command-extractor.outputs.result}}" == 'xlf') { + } else if ("${{steps.command-extractor.outputs.result}}" == 'xlf') { output = "${{steps.xlf.outputs.result}}" + } else if ("${{steps.command-extractor.outputs.result}}" == 'ilverify') { + output = "${{steps.ilverify.outputs.result}}" } 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}`; await github.issues.createComment({ From 13d8cb5f75fb02b9882936f2d67c1f1576acc633 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 May 2025 08:02:24 +0000 Subject: [PATCH 3/6] Update step name to match required name Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com> --- .github/workflows/commands.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/commands.yml b/.github/workflows/commands.yml index 3886581ac08..12555b1e2c5 100644 --- a/.github/workflows/commands.yml +++ b/.github/workflows/commands.yml @@ -80,7 +80,7 @@ jobs: if: steps.command-extractor.outputs.result == 'xlf' id: xlf run: dotnet build src/Compiler /t:UpdateXlf - - name: Process ilverify command + - name: Process ilverify command (Update ILVerify baselines) if: steps.command-extractor.outputs.result == 'ilverify' id: ilverify env: From a405fca1f94a6d8e5466a2abb4a1cca06d612549 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 May 2025 09:26:54 +0000 Subject: [PATCH 4/6] Add acknowledgment comment when ilverify command starts Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com> --- .github/workflows/commands.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/commands.yml b/.github/workflows/commands.yml index 12555b1e2c5..2ec6b730fd7 100644 --- a/.github/workflows/commands.yml +++ b/.github/workflows/commands.yml @@ -80,6 +80,19 @@ jobs: if: steps.command-extractor.outputs.result == 'xlf' id: xlf run: dotnet build src/Compiler /t:UpdateXlf + - name: Post ilverify start comment + if: steps.command-extractor.outputs.result == 'ilverify' + uses: actions/github-script@v3 + with: + script: | + const body = `Started to run ilverify baseline update`; + await github.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: body + }); + - name: Process ilverify command (Update ILVerify baselines) if: steps.command-extractor.outputs.result == 'ilverify' id: ilverify From d577958c904bdf06dbc829512bc5208bdd78ddc5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 May 2025 09:41:13 +0000 Subject: [PATCH 5/6] Update commands.yml to address PR feedback Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com> --- .github/workflows/commands.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/commands.yml b/.github/workflows/commands.yml index 2ec6b730fd7..a70181b92ad 100644 --- a/.github/workflows/commands.yml +++ b/.github/workflows/commands.yml @@ -99,9 +99,6 @@ jobs: env: TEST_UPDATE_BSL: 1 run: | - # Store the list of baseline files before running the script - BASELINE_FILES_BEFORE=$(ls -la tests/ILVerify/*.bsl) - # Run the ilverify script with TEST_UPDATE_BSL=1 pwsh tests/ILVerify/ilverify.ps1 @@ -120,14 +117,20 @@ jobs: fi done - if [ $FILES_CHANGED -eq 0 ]; then + if [ "$FILES_CHANGED" -eq 0 ]; then echo "result=The ilverify command ran and did not modify any baseline." >> $GITHUB_OUTPUT else - echo "result=The ilverify command ran and triggered the following number of changes per file:\n${CHANGES_OUTPUT}" >> $GITHUB_OUTPUT + echo -e "result=The ilverify command ran and triggered the following number of changes per file:\n${CHANGES_OUTPUT}" >> $GITHUB_OUTPUT fi - name: Commit and push changes if: steps.fantomas.outcome == 'success' || steps.xlf.outcome == 'success' || steps.ilverify.outcome == 'success' run: | + # Only commit if there are actual changes + if git diff --quiet; then + echo "No changes to commit, skipping." + exit 0 + fi + git config --local user.name "github-actions[bot]" git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" git commit -a -m 'Automated command ran: ${{ steps.command-extractor.outputs.result }} From 069fcfea9e8e5ba56558c10b6f46e4e66dedb948 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 May 2025 10:40:13 +0000 Subject: [PATCH 6/6] Update commands.yml to use ubuntu-latest instead of ubuntu-20.04 Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com> --- .github/workflows/commands.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/commands.yml b/.github/workflows/commands.yml index a70181b92ad..01203a6c562 100644 --- a/.github/workflows/commands.yml +++ b/.github/workflows/commands.yml @@ -14,7 +14,7 @@ permissions: jobs: cleanup_old_runs: if: github.event.schedule == '0 13 * * *' - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest permissions: actions: write env: @@ -33,7 +33,7 @@ jobs: run_command: if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/run') - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Extract command to run uses: actions/github-script@v3