Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post update hooks have no effect #3213

Open
MaciejG604 opened this issue Nov 14, 2023 · 7 comments · Fixed by VirtusLab/scala-cli#3465
Open

Post update hooks have no effect #3213

MaciejG604 opened this issue Nov 14, 2023 · 7 comments · Fixed by VirtusLab/scala-cli#3465

Comments

@MaciejG604
Copy link

In the scala-cli repo we have updated our .scala-steward.conf to include:

postUpdateHooks = [{
  command = ["./mill", "-i", "generate-reference-doc.run"],
  commitMessage = "Generate the reference doc"
}]

However, no commits with this message are ever generated e.g. here.
After setting up a separate steward-running repo, the hooks are launched correctly e.g. here.

@alejandrohdezma
Copy link
Member

Hey @MaciejG604, is that command generating new files our updating old ones? Because if that's the case I believe given this new files won't be added, and thus, a commit won't be created.

@MaciejG604
Copy link
Author

Hi, it should only update files that already exists, nothing new added.

@alejandrohdezma
Copy link
Member

🤔 Could you run Steward in debug mode to get more clarity onto what's happening?

@MaciejG604
Copy link
Author

How do I do that?

@alejandrohdezma
Copy link
Member

If you are using the Scala Steward GitHub Action, check Run Scala Steward with step debug logging under Guides.

@fthomas
Copy link
Member

fthomas commented Jan 27, 2025

I tried this locally with my dev instance and the post-update hook failed with:

2025-01-27 08:32:13,287 INFO  Process update com.github.plokhotnyuk.jsoniter-scala:{(jsoniter-scala-core, jsoniter-scala-core_2.12, jsoniter-scala-core_2.13, jsoniter-scala-core_3), (jsoniter-scala-macros, jsoniter-scala-macros_2.12, jsoniter-scala-macros_2.13, jsoniter-scala-macros_3)} : 2.13.5.2 -> 2.13.39
2025-01-27 08:32:13,674 INFO  Create branch update/jsoniter-scala-core-2.13.39
2025-01-27 08:32:20,758 INFO  Executing post-update hook for com.github.plokhotnyuk.jsoniter-scala:jsoniter-scala-core with command './mill -i 'generate-reference-doc[]'.run'
2025-01-27 08:32:53,856 WARN  Post-update hook failed
org.scalasteward.core.io.process$ProcessFailedException: './mill -i 'generate-reference-doc[]'.run' exited with code 1.
[info] compiling 6 Scala sources to workspace/repos/VirtusLab/scala-cli/out/mill-build/compile.dest/classes ...
[warn] workspace/repos/VirtusLab/scala-cli/project/settings.sc:543:57: trait SbtModuleTests in trait SbtModule is deprecated (since Mill 0.11.10): Use SbtTests instead
[warn]   trait ScalaCliTests extends ScalaCliModule with super.SbtModuleTests with TestModule.Munit {
[warn]                                                         ^
[warn] workspace/repos/VirtusLab/scala-cli/project/settings.sc:578:15: method publish in class LocalIvyPublisher is deprecated (since Mill 0.11.7): Use publishLocal instead
[warn]     publisher.publish(
[warn]               ^
[warn] two warnings found
[info] done compiling
Parsing exception Position 1:1, found "'generate-"

Running the command in the shell works just fine but I can reproduce the above error with a simple Scala script:

$ cat run.sc 
val pb = new java.lang.ProcessBuilder("./mill", "-i", "'generate-reference-doc[]'.run")
pb.inheritIO
pb.start
$ scala-cli run run.sc 
[build.sc] [50/59] zincReportCachedProblems 
Parsing exception Position 1:1, found "'generate-"

Maybe the public Scala Steward instance fails with the same error. And I've no idea why that does not happen with the GH Action.

@fthomas
Copy link
Member

fthomas commented Jan 27, 2025

It works for me if the single quotes around generate-reference-doc[] are removed:

 postUpdateHooks = [{
-  command = ["./mill", "-i", "'generate-reference-doc[]'.run"],
+  command = ["./mill", "-i", "generate-reference-doc[].run"],
   commitMessage = "Generate the reference doc"
 }]

Please give this a try, @MaciejG604.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants