Skip to content

Commit 2af7d6c

Browse files
committed
Add support for providing custom hash to the cursor deploy
1 parent b1fee0d commit 2af7d6c

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

actions/cursor-deploy/action.yml

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ inputs:
1313
description: The deployment mode (default / rollback / unblock)
1414
required: false
1515
default: 'default'
16+
custom_hash:
17+
required: false
18+
description: 'Custom hash of the deployment'
1619
outputs:
1720
tree_hash:
1821
description: The tree hash of the performed deployment

actions/cursor-deploy/dist/main/index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -24312,8 +24312,10 @@ runAction(async () => {
2431224312
const bucket = core2.getInput("bucket_name", { required: true });
2431324313
const deployModeInput = core2.getInput("deploy_mode", { required: true });
2431424314
const rollbackCommitHash = core2.getInput("rollback_commit_hash");
24315+
const customHash = core2.getInput("custom_hash");
2431524316
const output = await cursorDeploy({
2431624317
bucket,
24318+
customHash,
2431724319
deployModeInput,
2431824320
rollbackCommitHash,
2431924321
ref: ((_b = (_a2 = github.context.payload) == null ? void 0 : _a2.pull_request) == null ? void 0 : _b.head.ref) ?? github.context.ref
@@ -24324,12 +24326,14 @@ runAction(async () => {
2432424326
async function cursorDeploy({
2432524327
ref,
2432624328
bucket,
24329+
// NOTE: Using custom hash for deployment doesn't work will the rollback/unblock workflows
24330+
customHash,
2432724331
deployModeInput,
2432824332
rollbackCommitHash
2432924333
}) {
2433024334
const deployMode = getDeployMode(deployModeInput);
2433124335
const branchLabel = branchNameToHostnameLabel(ref);
24332-
const treeHash = await getDeploymentHash(deployMode, rollbackCommitHash);
24336+
const treeHash = customHash ?? await getDeploymentHash(deployMode, rollbackCommitHash);
2433324337
const rollbackKey = `rollbacks/${branchLabel}`;
2433424338
const deployKey = `deploys/${branchLabel}`;
2433524339
if (deployMode === "default" || deployMode === "unblock") {

actions/cursor-deploy/index.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ runAction(async () => {
2727
const bucket = core.getInput('bucket_name', {required: true})
2828
const deployModeInput = core.getInput('deploy_mode', {required: true})
2929
const rollbackCommitHash = core.getInput('rollback_commit_hash')
30+
const customHash = core.getInput('custom_hash')
3031

3132
const output = await cursorDeploy({
3233
bucket,
34+
customHash,
3335
deployModeInput,
3436
rollbackCommitHash,
3537
ref: github.context.payload?.pull_request?.head.ref ?? github.context.ref
@@ -42,19 +44,22 @@ runAction(async () => {
4244
interface CursorDeployActionArgs {
4345
bucket: string
4446
deployModeInput: string
47+
customHash?: string
4548
rollbackCommitHash: string
4649
ref: string
4750
}
4851

4952
export async function cursorDeploy({
5053
ref,
5154
bucket,
55+
// NOTE: Using custom hash for deployment doesn't work will the rollback/unblock workflows
56+
customHash,
5257
deployModeInput,
5358
rollbackCommitHash
5459
}: CursorDeployActionArgs) {
5560
const deployMode = getDeployMode(deployModeInput)
5661
const branchLabel = branchNameToHostnameLabel(ref)
57-
const treeHash = await getDeploymentHash(deployMode, rollbackCommitHash)
62+
const treeHash = customHash ?? (await getDeploymentHash(deployMode, rollbackCommitHash))
5863

5964
const rollbackKey = `rollbacks/${branchLabel}`
6065
const deployKey = `deploys/${branchLabel}`

0 commit comments

Comments
 (0)