djspiewak / sbt-github-packages

A simple sbt plugin for publishing to GitHub Packages, in the style of sbt-sonatype and sbt-bintray
Apache License 2.0
175 stars 27 forks source link

Publish should not depend on running tests/compilation #27

Open lemastero opened 4 years ago

lemastero commented 4 years ago

I have following use case:

I saw an awesome library. I git clone it. Try to run sbt test and got this:

[error] java.lang.RuntimeException: unable to locate a valid GitHub token from GitConfig(github.token)
[error]         at scala.sys.package$.error(package.scala:30)
[error]         at sbtghpackages.GitHubPackagesPlugin$.$anonfun$authenticationSettings$2(GitHubPackagesPlugin.scala:53)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error]         at sbt.std.Transform$$anon$4.work(Transform.scala:67)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:281)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19)
[error]         at sbt.Execute.work(Execute.scala:290)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:281)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error]         at java.lang.Thread.run(Thread.java:748)
[error] (credentials) unable to locate a valid GitHub token from GitConfig(github.token)

Probably the config of publication should not break testing (as functions should not send missiles with atomic bombs when asked to run diagnostics).

I am reluctant to reveal my private matters to strangers - so I prefer to keep my tokens to myself.

So in order to introduce fix in the library using this plugin, I need to:

  1. comment out the plugin + config
  2. introduce change
  3. comment back the plugin + config
  4. send PR

That is error-prone (I am committing different code that I tested) and a slightly inconvenient.

Possibly related to #16