* https://docs.github.com/en/rest/reference/repos#create-a-deployment
(options = {})
| 30 | * https://docs.github.com/en/rest/reference/repos#create-a-deployment |
| 31 | */ |
| 32 | async function createDeployment(options = {}) { |
| 33 | const [owner, repo] = env.GITHUB_REPOSITORY?.split("/") ?? []; |
| 34 | const gh = new Octokit({ auth: env.GITHUB_TOKEN }); |
| 35 | |
| 36 | console.log("Creating a new deployment..."); |
| 37 | const res = await gh.repos.createDeployment({ |
| 38 | mediaType: { previews: ["ant-man"] }, |
| 39 | owner, |
| 40 | repo, |
| 41 | ref: options.ref, |
| 42 | task: options.task, |
| 43 | auto_merge: options.auto_merge, |
| 44 | required_contexts: [], |
| 45 | payload: options.payload, |
| 46 | environment: options.env, |
| 47 | description: options.description, |
| 48 | transient_environment: |
| 49 | options.transient === undefined ? true : options.transient, |
| 50 | production_environment: options.env === "production", |
| 51 | }); |
| 52 | const id = res.data.id; |
| 53 | |
| 54 | if (id) { |
| 55 | console.log(`::set-output name=id::${id}`); |
| 56 | await createDeploymentStatus({ |
| 57 | state: "in_progress", |
| 58 | ...options, |
| 59 | id, |
| 60 | }); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * https://docs.github.com/en/rest/reference/repos#delete-a-deployment |
no test coverage detected