/packages/nodes-base/nodes/CircleCi/PipelineDescription.ts

https://github.com/n8n-io/n8n · TypeScript · 229 lines · 211 code · 6 blank · 12 comment · 2 complexity · 7019c74ec615cc5a0e49041711a09908 MD5 · raw file

  1. import {
  2. INodeProperties,
  3. } from 'n8n-workflow';
  4. export const pipelineOperations = [
  5. {
  6. displayName: 'Operation',
  7. name: 'operation',
  8. type: 'options',
  9. displayOptions: {
  10. show: {
  11. resource: [
  12. 'pipeline',
  13. ],
  14. },
  15. },
  16. options: [
  17. {
  18. name: 'Get',
  19. value: 'get',
  20. description: 'Get a pipeline',
  21. },
  22. {
  23. name: 'Get All',
  24. value: 'getAll',
  25. description: 'Get all pipelines',
  26. },
  27. {
  28. name: 'Trigger',
  29. value: 'trigger',
  30. description: 'Trigger a pipeline',
  31. },
  32. ],
  33. default: 'get',
  34. description: 'The operation to perform.',
  35. },
  36. ] as INodeProperties[];
  37. export const pipelineFields = [
  38. /* -------------------------------------------------------------------------- */
  39. /* pipeline:shared */
  40. /* -------------------------------------------------------------------------- */
  41. {
  42. displayName: 'Provider',
  43. name: 'vcs',
  44. type: 'options',
  45. options: [
  46. {
  47. name: 'Bitbucket',
  48. value: 'bitbucket',
  49. },
  50. {
  51. name: 'GitHub',
  52. value: 'github',
  53. },
  54. ],
  55. displayOptions: {
  56. show: {
  57. operation: [
  58. 'get',
  59. 'getAll',
  60. 'trigger',
  61. ],
  62. resource: [
  63. 'pipeline',
  64. ],
  65. },
  66. },
  67. default: '',
  68. description: 'Version control system',
  69. },
  70. {
  71. displayName: 'Project Slug',
  72. name: 'projectSlug',
  73. type: 'string',
  74. displayOptions: {
  75. show: {
  76. operation: [
  77. 'get',
  78. 'getAll',
  79. 'trigger',
  80. ],
  81. resource: [
  82. 'pipeline',
  83. ],
  84. },
  85. },
  86. default: '',
  87. placeholder: 'n8n-io/n8n',
  88. description: 'Project slug in the form org-name/repo-name',
  89. },
  90. /* -------------------------------------------------------------------------- */
  91. /* pipeline:get */
  92. /* -------------------------------------------------------------------------- */
  93. {
  94. displayName: 'Pipeline Number',
  95. name: 'pipelineNumber',
  96. type: 'number',
  97. typeOptions: {
  98. minValue: 1,
  99. },
  100. displayOptions: {
  101. show: {
  102. operation: [
  103. 'get',
  104. ],
  105. resource: [
  106. 'pipeline',
  107. ],
  108. },
  109. },
  110. default: 1,
  111. description: 'The number of the pipeline',
  112. },
  113. /* -------------------------------------------------------------------------- */
  114. /* pipeline:getAll */
  115. /* -------------------------------------------------------------------------- */
  116. {
  117. displayName: 'Return All',
  118. name: 'returnAll',
  119. type: 'boolean',
  120. displayOptions: {
  121. show: {
  122. operation: [
  123. 'getAll',
  124. ],
  125. resource: [
  126. 'pipeline',
  127. ],
  128. },
  129. },
  130. default: false,
  131. description: 'If all results should be returned or only up to a given limit.',
  132. },
  133. {
  134. displayName: 'Limit',
  135. name: 'limit',
  136. type: 'number',
  137. displayOptions: {
  138. show: {
  139. operation: [
  140. 'getAll',
  141. ],
  142. resource: [
  143. 'pipeline',
  144. ],
  145. returnAll: [
  146. false,
  147. ],
  148. },
  149. },
  150. typeOptions: {
  151. minValue: 1,
  152. maxValue: 500,
  153. },
  154. default: 100,
  155. description: 'How many results to return.',
  156. },
  157. {
  158. displayName: 'Filters',
  159. name: 'filters',
  160. type: 'collection',
  161. placeholder: 'Add Filter',
  162. default: {},
  163. displayOptions: {
  164. show: {
  165. resource: [
  166. 'pipeline',
  167. ],
  168. operation: [
  169. 'getAll',
  170. ],
  171. },
  172. },
  173. options: [
  174. {
  175. displayName: 'Branch',
  176. name: 'branch',
  177. type: 'string',
  178. default: '',
  179. description: 'The name of a vcs branch.',
  180. },
  181. ],
  182. },
  183. /* -------------------------------------------------------------------------- */
  184. /* pipeline:trigger */
  185. /* -------------------------------------------------------------------------- */
  186. {
  187. displayName: 'Additional Fields',
  188. name: 'additionalFields',
  189. type: 'collection',
  190. placeholder: 'Add Field',
  191. default: {},
  192. displayOptions: {
  193. show: {
  194. resource: [
  195. 'pipeline',
  196. ],
  197. operation: [
  198. 'trigger',
  199. ],
  200. },
  201. },
  202. options: [
  203. {
  204. displayName: 'Branch',
  205. name: 'branch',
  206. type: 'string',
  207. default: '',
  208. description: `The branch where the pipeline ran.<br/>
  209. The HEAD commit on this branch was used for the pipeline.<br/>
  210. Note that branch and tag are mutually exclusive.`,
  211. },
  212. {
  213. displayName: 'Tag',
  214. name: 'tag',
  215. type: 'string',
  216. default: '',
  217. description: `The tag used by the pipeline.<br/>
  218. The commit that this tag points to was used for the pipeline.<br/>
  219. Note that branch and tag are mutually exclusive`,
  220. },
  221. ],
  222. },
  223. ] as INodeProperties[];