core.d.ts 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /**
  2. * Interface for getInput options
  3. */
  4. export interface InputOptions {
  5. /** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
  6. required?: boolean;
  7. }
  8. /**
  9. * The code to exit an action
  10. */
  11. export declare enum ExitCode {
  12. /**
  13. * A code indicating that the action was successful
  14. */
  15. Success = 0,
  16. /**
  17. * A code indicating that the action was a failure
  18. */
  19. Failure = 1
  20. }
  21. /**
  22. * sets env variable for this action and future actions in the job
  23. * @param name the name of the variable to set
  24. * @param val the value of the variable
  25. */
  26. export declare function exportVariable(name: string, val: string): void;
  27. /**
  28. * exports the variable and registers a secret which will get masked from logs
  29. * @param name the name of the variable to set
  30. * @param val value of the secret
  31. */
  32. export declare function exportSecret(name: string, val: string): void;
  33. /**
  34. * Prepends inputPath to the PATH (for this action and future actions)
  35. * @param inputPath
  36. */
  37. export declare function addPath(inputPath: string): void;
  38. /**
  39. * Gets the value of an input. The value is also trimmed.
  40. *
  41. * @param name name of the input to get
  42. * @param options optional. See InputOptions.
  43. * @returns string
  44. */
  45. export declare function getInput(name: string, options?: InputOptions): string;
  46. /**
  47. * Sets the value of an output.
  48. *
  49. * @param name name of the output to set
  50. * @param value value to store
  51. */
  52. export declare function setOutput(name: string, value: string): void;
  53. /**
  54. * Sets the action status to failed.
  55. * When the action exits it will be with an exit code of 1
  56. * @param message add error issue message
  57. */
  58. export declare function setFailed(message: string): void;
  59. /**
  60. * Writes debug message to user log
  61. * @param message debug message
  62. */
  63. export declare function debug(message: string): void;
  64. /**
  65. * Adds an error issue
  66. * @param message error issue message
  67. */
  68. export declare function error(message: string): void;
  69. /**
  70. * Adds an warning issue
  71. * @param message warning issue message
  72. */
  73. export declare function warning(message: string): void;
  74. /**
  75. * Writes info to log with console.log.
  76. * @param message info message
  77. */
  78. export declare function info(message: string): void;
  79. /**
  80. * Begin an output group.
  81. *
  82. * Output until the next `groupEnd` will be foldable in this group
  83. *
  84. * @param name The name of the output group
  85. */
  86. export declare function startGroup(name: string): void;
  87. /**
  88. * End an output group.
  89. */
  90. export declare function endGroup(): void;
  91. /**
  92. * Wrap an asynchronous function call in a group.
  93. *
  94. * Returns the same type as the function itself.
  95. *
  96. * @param name The name of the group
  97. * @param fn The function to wrap in the group
  98. */
  99. export declare function group<T>(name: string, fn: () => Promise<T>): Promise<T>;