Skip to content

Commit

Permalink
wip: testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgilman committed Sep 10, 2024
1 parent d4f63a5 commit fbe0309
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
4 changes: 4 additions & 0 deletions forge/actions/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ inputs:
image:
description: The full image name (name:tag) to publish
required: true
skip_branch_check:
description: If true, will always publish images, even on pushes to the non-default branch
required: false
default: "false"

runs:
using: node20
Expand Down
7 changes: 3 additions & 4 deletions forge/actions/publish/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30443,6 +30443,7 @@ async function run() {
try {
const project = core.getInput("project", { required: true });
const image = core.getInput("image", { required: true });
const skip_branch_check = core.getBooleanInput("skip_branch_check");

const exists = await imageExists(image);
if (!exists) {
Expand All @@ -30452,15 +30453,13 @@ async function run() {
file: `${project}/Earthfile`,
},
);
core.setFailed(
`Image '${image}' does not exist in the local Docker daemon`,
);
core.setFailed(`Unable to find image: ${image}`);
return;
}

const currentBranch = github.context.ref.replace("refs/heads/", "");
const defaultBranch = github.context.payload.repository.default_branch;
if (currentBranch !== defaultBranch) {
if (currentBranch !== defaultBranch && !skip_branch_check) {
core.info("Not on default branch, skipping publish");
return;
}
Expand Down
2 changes: 1 addition & 1 deletion forge/actions/publish/dist/index.js.map

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions forge/actions/publish/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ async function run() {
try {
const project = core.getInput("project", { required: true });
const image = core.getInput("image", { required: true });
const skip_branch_check = core.getBooleanInput("skip_branch_check");

const exists = await imageExists(image);
if (!exists) {
Expand All @@ -15,15 +16,13 @@ async function run() {
file: `${project}/Earthfile`,
},
);
core.setFailed(
`Image '${image}' does not exist in the local Docker daemon`,
);
core.setFailed(`Unable to find image: ${image}`);
return;
}

const currentBranch = github.context.ref.replace("refs/heads/", "");
const defaultBranch = github.context.payload.repository.default_branch;
if (currentBranch !== defaultBranch) {
if (currentBranch !== defaultBranch && !skip_branch_check) {
core.info("Not on default branch, skipping publish");
return;
}
Expand Down

0 comments on commit fbe0309

Please sign in to comment.