@@ -19,8 +19,8 @@ object GithubAction {
1919 /* * Return workflow run's URL */
2020 val workflowRunURL
2121 get() =
22- when (isEnabled) {
23- true ->
22+ when {
23+ isEnabled ->
2424 " ${Env .GITHUB_SERVER_URL } /${Env .GITHUB_REPOSITORY } /actions/runs/${Env .GITHUB_RUN_ID } "
2525 else -> null
2626 }
@@ -331,7 +331,7 @@ object GithubAction {
331331
332332 /* *
333333 * The name of the action currently running, or the id of a step. For example, for an action,
334- * __repo-owner_name-of-action-repo. GitHub removes special characters, and uses the name __run
334+ * __repo-owner_name-of-action-repo.GitHub removes special characters, and uses the name __run
335335 * when the current step runs a script without an id. If you use the same script or action more
336336 * than once in the same job, the name will include a suffix that consists of the sequence
337337 * number preceded by an underscore. For example, the first script you run will have the name
@@ -343,8 +343,9 @@ object GithubAction {
343343
344344 /* *
345345 * The path where an action is located. This property is only supported in composite actions.
346- * You can use this path to access files located in the same repository as the action. For
347- * example, /home/runner/work/_actions/repo-owner/name-of-action-repo/v1.
346+ * You can use this path to change directories to where the action is located and access other
347+ * files in that same repository. For example,
348+ * /home/runner/work/_actions/repo-owner/name-of-action-repo/v1.
348349 */
349350 val GITHUB_ACTION_PATH
350351 get() = getenv(" GITHUB_ACTION_PATH" )
@@ -367,6 +368,13 @@ object GithubAction {
367368 val GITHUB_ACTOR
368369 get() = getenv(" GITHUB_ACTOR" )
369370
371+ /* *
372+ * The account ID of the person or app that triggered the initial workflow run. For
373+ * example, 1234567. Note that this is different from the actor username.
374+ */
375+ val GITHUB_ACTOR_ID
376+ get() = getenv(" GITHUB_ACTOR_ID" )
377+
370378 /* * Returns the API URL. For example: https://api.github.com. */
371379 val GITHUB_API_URL
372380 get() = getenv(" GITHUB_API_URL" )
@@ -380,8 +388,8 @@ object GithubAction {
380388 get() = getenv(" GITHUB_BASE_REF" )
381389
382390 /* *
383- * The path on the runner to the file that sets environment variables from workflow commands.
384- * This file is unique to the current step and changes for each step in a job. For example,
391+ * The path on the runner to the file that sets variables from workflow commands. This file is
392+ * unique to the current step and changes for each step in a job. For example,
385393 * /home/runner/work/_temp/_runner_file_commands/set_env_87406d6e-4979-4d42-98e1-3dab1f48b13a.
386394 * For more information, see "Workflow commands for GitHub Actions."
387395 */
@@ -415,6 +423,16 @@ object GithubAction {
415423 val GITHUB_JOB
416424 get() = getenv(" GITHUB_JOB" )
417425
426+ /* *
427+ * The path on the runner to the file that sets the current step's outputs from workflow
428+ * commands. This file is unique to the current step and changes for each step in a job. For
429+ * example,
430+ * /home/runner/work/_temp/_runner_file_commands/set_output_a50ef383-b063-46d9-9157-57953fc9f3f0.
431+ * For more information, see "Workflow commands for GitHub Actions."
432+ */
433+ val GITHUB_OUTPUT
434+ get() = getenv(" GITHUB_OUTPUT" )
435+
418436 /* *
419437 * The path on the runner to the file that sets system PATH variables from workflow commands.
420438 * This file is unique to the current step and changes for each step in a job. For example,
@@ -439,12 +457,16 @@ object GithubAction {
439457
440458 /* *
441459 * The short ref name of the branch or tag that triggered the workflow run. This value matches
442- * the branch or tag name shown on GitHub. For example, feature-branch-1.
460+ * the branch or tag name shown on GitHub. For example, feature-branch-1. For pull requests, the
461+ * format is refs/pull/<pr_number>/merge.
443462 */
444463 val GITHUB_REF_NAME
445464 get() = getenv(" GITHUB_REF_NAME" )
446465
447- /* * true if branch protections are configured for the ref that triggered the workflow run. */
466+ /* *
467+ * true if branch protections or rulesets are configured for the ref that triggered the workflow
468+ * run.
469+ */
448470 val GITHUB_REF_PROTECTED
449471 get() = getenv(" GITHUB_REF_PROTECTED" )
450472
@@ -456,10 +478,24 @@ object GithubAction {
456478 val GITHUB_REPOSITORY
457479 get() = getenv(" GITHUB_REPOSITORY" )
458480
481+ /* *
482+ * The ID of the repository. For example, 123456789. Note that this is different from the
483+ * repository name.
484+ */
485+ val GITHUB_REPOSITORY_ID
486+ get() = getenv(" GITHUB_REPOSITORY_ID" )
487+
459488 /* * The repository owner's name. For example, octocat. */
460489 val GITHUB_REPOSITORY_OWNER
461490 get() = getenv(" GITHUB_REPOSITORY_OWNER" )
462491
492+ /* *
493+ * The repository owner's account ID. For example, 1234567. Note that this is different from the
494+ * owner's name.
495+ */
496+ val GITHUB_REPOSITORY_OWNER_ID
497+ get() = getenv(" GITHUB_REPOSITORY_OWNER_ID" )
498+
463499 /* * The number of days that workflow run logs and artifacts are kept. For example, 90. */
464500 val GITHUB_RETENTION_DAYS
465501 get() = getenv(" GITHUB_RETENTION_DAYS" )
@@ -502,19 +538,39 @@ object GithubAction {
502538 /* *
503539 * The path on the runner to the file that contains job summaries from workflow commands. This
504540 * file is unique to the current step and changes for each step in a job. For example,
505- * /home/rob/ runner/_layout/_work/_temp/_runner_file_commands/step_summary_1cb22d7f-5663-41a8-9ffc-13472605c76c.
541+ * /home/runner/_layout/_work/_temp/_runner_file_commands/step_summary_1cb22d7f-5663-41a8-9ffc-13472605c76c.
506542 * For more information, see "Workflow commands for GitHub Actions."
507543 */
508544 val GITHUB_STEP_SUMMARY
509545 get() = getenv(" GITHUB_STEP_SUMMARY" )
510546
547+ /* *
548+ * The username of the user that initiated the workflow run. If the workflow run is a re-run,
549+ * this value may differ from github.actor. Any workflow re-runs will use the privileges of
550+ * github.actor, even if the actor initiating the re-run (github.triggering_actor) has different
551+ * privileges.
552+ */
553+ val GITHUB_TRIGGERING_ACTOR
554+ get() = getenv(" GITHUB_TRIGGERING_ACTOR" )
555+
511556 /* *
512557 * The name of the workflow. For example, My test workflow. If the workflow file doesn't specify
513558 * a name, the value of this variable is the full path of the workflow file in the repository.
514559 */
515560 val GITHUB_WORKFLOW
516561 get() = getenv(" GITHUB_WORKFLOW" )
517562
563+ /* *
564+ * The ref path to the workflow. For example,
565+ * octocat/hello-world/.github/workflows/my-workflow.yml@refs/heads/my_branch.
566+ */
567+ val GITHUB_WORKFLOW_REF
568+ get() = getenv(" GITHUB_WORKFLOW_REF" )
569+
570+ /* * The commit SHA for the workflow file. */
571+ val GITHUB_WORKFLOW_SHA
572+ get() = getenv(" GITHUB_WORKFLOW_SHA" )
573+
518574 /* *
519575 * The default working directory on the runner for steps, and the default location of your
520576 * repository when using the checkout action. For example,
@@ -537,7 +593,11 @@ object GithubAction {
537593 val RUNNER_DEBUG
538594 get() = getenv(" RUNNER_DEBUG" ) == " 1"
539595
540- /* * The name of the runner executing the job. For example, Hosted Agent */
596+ /* *
597+ * The name of the runner executing the job. This name may not be unique in a workflow run as
598+ * runners at the repository and organization levels could use the same name. For example,
599+ * Hosted Agent
600+ */
541601 val RUNNER_NAME
542602 get() = getenv(" RUNNER_NAME" )
543603
@@ -558,7 +618,7 @@ object GithubAction {
558618
559619 /* *
560620 * The path to the directory containing preinstalled tools for GitHub-hosted runners. For more
561- * information, see "About GitHub-hosted runners". For example, C:\hostedtoolcache\windows
621+ * information, see "Using GitHub-hosted runners". For example, C:\hostedtoolcache\windows
562622 */
563623 val RUNNER_TOOL_CACHE
564624 get() = getenv(" RUNNER_TOOL_CACHE" )
@@ -578,17 +638,17 @@ object GithubAction {
578638 val RUNNER_CONTEXT
579639 get() = getenv(" RUNNER_CONTEXT" )
580640
581- /* * OpenJDK 8 Home */
582- val JAVA_HOME_8_X64
583- get() = getenv( " JAVA_HOME_8_X64 " )
584-
585- /* * OpenJDK 11 Home */
586- val JAVA_HOME_11_X64
587- get() = getenv( " JAVA_HOME_11_X64 " )
588-
589- /* * OpenJDK 17 Home */
590- val JAVA_HOME_17_X64
591- get() = getenv( " JAVA_HOME_17_X64 " )
641+ fun javaHomeFor ( version : Int = 21) =
642+ when (version) {
643+ 8 ,
644+ 11 ,
645+ 17 ,
646+ 21 -> {
647+ val arch = if ( RUNNER_ARCH == " ARM64 " ) RUNNER_ARCH .lowercase() else RUNNER_ARCH
648+ getenv( " JAVA_HOME_ ${version} _ ${arch} " )
649+ }
650+ else -> throw IllegalArgumentException ( " Unsupported Java version: $version " )
651+ }
592652
593653 /* * Gets the value of the environment variable set in the Github action runner. */
594654 operator fun get (name : String ): String? = getenv(name)
0 commit comments