Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ inputs:
mcc_project:
description: "MACH Composer Project"
required: true
allow_component_not_found:
description: "Allow component not found in MCC. This will cause the component to always be marked as changed."
required: false
default: "false"
Copy link
Copy Markdown

@tleguijt tleguijt Jul 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the default just be true?
It won't break any of the existing functionality I suppose

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might cause some unexpected side effect. Without it will just pipe down the error to a later stage when building and registering the component happens. This would probably break in a run on main instead. That is obviously fixable by adding the --create-component flag in mach, but I don't know if we want that to happen as a default now?

fallback_reference:
description: "Fallback git reference to compare against (useful for hotfix branches)"
required: false
Expand Down
25 changes: 19 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19701,7 +19701,7 @@ var require_core = __commonJS({
return inputs.map((input) => input.trim());
}
exports.getMultilineInput = getMultilineInput;
function getBooleanInput(name, options) {
function getBooleanInput2(name, options) {
const trueValue = ["true", "True", "TRUE"];
const falseValue = ["false", "False", "FALSE"];
const val = getInput2(name, options);
Expand All @@ -19712,7 +19712,7 @@ var require_core = __commonJS({
throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}
Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
}
exports.getBooleanInput = getBooleanInput;
exports.getBooleanInput = getBooleanInput2;
function setOutput2(name, value) {
const filePath = process.env["GITHUB_OUTPUT"] || "";
if (filePath) {
Expand Down Expand Up @@ -35345,7 +35345,10 @@ var getTurboPlan = async (commit) => {
write(chunk, encoding, callback) {
}
});
const command = `pnpm --silent turbo run build --filter="...[${commit}]" --dry=json`;
let command = `pnpm --silent turbo run build --dry=json`;
if (commit) {
command += ` --filter="...[${commit}]" `;
}
const options = {
env: {
TURBO_TELEMETRY_DISABLED: "1",
Expand Down Expand Up @@ -35413,7 +35416,7 @@ var Client = class {
this.token = token.accessToken;
return this.token;
};
getLatestVersion = async (component, branch) => {
getLatestVersion = async (component, branch, allowComponentNotFound) => {
const url = `https://api.mach.cloud/organizations/${this.credentials.organization}/projects/${this.credentials.project}/components/${component}/latest?branch=${branch}`;
console.log("Request info from " + url);
const response = await fetch(url, {
Expand All @@ -35422,6 +35425,12 @@ var Client = class {
}
});
if (!response.ok) {
if (response.status === 404 && allowComponentNotFound) {
console.warn(
`Component ${component} not found in branch ${branch}. Continuing without it.`
);
return null;
}
console.log(await response.text());
throw new Error("Failed to fetch latest version");
}
Expand Down Expand Up @@ -35451,7 +35460,8 @@ async function run() {
core3.info(`Processing ${pkgConfig.name}`);
const commitHash = await client.getLatestVersion(
pkgConfig.name,
inputs.branch
inputs.branch,
inputs.allowComponentNotFound
);
let affectedPackages = [];
if (commitHash) {
Expand All @@ -35461,6 +35471,8 @@ async function run() {
pkgConfig,
inputs.fallbackReference
);
} else if (inputs.allowComponentNotFound) {
affectedPackages = [pkgConfig.scope];
}
for (const pkg of affectedPackages) {
if (!result.includes(pkg)) {
Expand All @@ -35483,7 +35495,8 @@ var readInputs = () => {
mccClientID: core3.getInput("mcc_client_id"),
mccClientSecret: core3.getInput("mcc_client_secret"),
mccOrganization: core3.getInput("mcc_organization"),
mccProject: core3.getInput("mcc_project")
mccProject: core3.getInput("mcc_project"),
allowComponentNotFound: core3.getBooleanInput("allow_component_not_found")
};
};

Expand Down
Loading