A template to demonstrate how to build a Java action via JEP 330: Launch Single-File Source-Code Programs.
This action prints "Hello World" to the log or "Hello" + the name of a person to greet.
To learn how this action was built, see "Creating a composite run steps action" in the GitHub Help documentation.
Required The name of the person to greet. Default "World".
Returns the next pseudorandom, Gaussian ("normally") distributed
doublevalue with mean0.0and standard deviation1.0from this random number generator's sequence.
See java.util.Random#nextGaussian() for details.
jobs:
build:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- id: hello
uses: sormuras/hello-world-java-action@v1
with:
who-to-greet: 'Mona the Octocat'
- run: echo random-number ${{ steps.hello.outputs.random-number }}
shell: bashimport java.util.Random;
class Action {
public static void main(String... args) {
System.out.printf("Hello %s.%n", args.length == 0 ? "Java" : args[0]);
var gaussian = new Random().nextGaussian();
System.out.println("::set-output name=random-number::" + gaussian);
System.out.println("Goodbye and have fun with: " + gaussian);
}
}https://github.community/t/use-java-11-as-github-action-scripting-language/136755