Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ci_check_license_headers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
pnpm_cache: "false"

- name: "Setup JDK 17"
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
java-version: 17
distribution: "temurin"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Initialize CodeQL
uses: github/codeql-action/init@5595ccaf912efad79be6eef63a5619ff05969be3 # v4.37.6
uses: github/codeql-action/init@db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28 # v4.37.8
with:
languages: ${{ matrix.language }}
queries: security-extended

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@5595ccaf912efad79be6eef63a5619ff05969be3 # v4.37.6
uses: github/codeql-action/analyze@db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28 # v4.37.8
2 changes: 1 addition & 1 deletion .github/workflows/prepare-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: pnpm install

- name: Create Release Pull Request
uses: changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d # v1.9.0
uses: changesets/action@8488615a623b1b9c987934bb89eae8af6a946ac1 # v2.1.1
with:
version: pnpm changeset version
title: "chore: version packages"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ jobs:
run: pnpm build:prod

- name: Publish to npm
uses: changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d # v1.9.0
uses: changesets/action@8488615a623b1b9c987934bb89eae8af6a946ac1 # v2.1.1
with:
publish: pnpm changeset publish
17 changes: 15 additions & 2 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,20 @@
publish = "packages/open-workflow-diagram-editor/dist-storybook"
ignore = """
set -e -o pipefail
git fetch --no-tags --depth=1 origin main:refs/remotes/origin/main

if [ -n "${REVIEW_ID:-}" ]; then
# For PR previews, fetch GitHub's synthetic merge commit.
FETCH_REF="refs/pull/${REVIEW_ID}/merge"
else
# For branch builds, fetch the branch being deployed.
FETCH_REF="$BRANCH"
fi

# Always deploy if fetch fails.
git fetch --no-tags --depth=2 origin "$FETCH_REF" || exit 1
BASE_REF="$(git rev-parse FETCH_HEAD^1)"
echo "FETCH_REF=$FETCH_REF BASE_REF=$BASE_REF"

npm i -g "pnpm@$PNPM_VERSION"
! pnpm -F '...[origin/main]' -rc exec 'echo "$PNPM_PACKAGE_NAME"' | grep -Fqx "$PREVIEW_PACKAGE_NAME"
! pnpm -F "...[$BASE_REF]" -rc exec 'echo "$PNPM_PACKAGE_NAME"' | grep -Fqx "$PREVIEW_PACKAGE_NAME"
"""
13 changes: 6 additions & 7 deletions packages/open-workflow-diagram-editor/src/core/workflowSdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { load, dump } from "js-yaml";
import { load } from "js-yaml";
import * as sdk from "@openworkflowspec/sdk";
import { fixNodesConnections } from "./graph";
import { stripSpecAheadOfSdkErrors } from "./specWorkarounds";
Expand Down Expand Up @@ -295,10 +295,9 @@ export function serializeWorkflow(
model: sdk.Specification.Workflow,
format: ContentFormat,
): string {
// The SDK validates the model before serializing it and it may cause validation exceptions
// Even if we have a model with validation errors we want it to be serialized
const json = JSON.stringify(model);
if (format === "json") return json;
// dump only works with plain objects.
return dump(JSON.parse(json));
if (format === "json") {
return sdk.Classes.Workflow.serialize(model, { format: "json", validate: false });
}

return sdk.Classes.Workflow.serialize(model, { format: "yaml", validate: false });
}
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,17 @@ describe("buildFlatGraph", () => {
expect(graph).toMatchSnapshot();
});

it("buildFlatGraph exception", () => {
it("returns a minimal graph for a workflow with no tasks", () => {
const { model } = parseWorkflow(EMPTY_WORKFLOW_JSON);
expect(model).not.toBeNull();

// A model without tasks is invalid however it produces a viable model instance
expect(() => buildFlatGraph(model!)).toThrow();
// A model with empty `do` is invalid but the SDK now handles it gracefully,
// returning a root graph with just entry/exit nodes.
const graph = buildFlatGraph(model!);
expect(graph.nodes).toHaveLength(2);
expect(graph.edges).toHaveLength(1);
expect(graph.entryNode?.id).toBe("root-entry-node");
expect(graph.exitNode?.id).toBe("root-exit-node");
});
});

Expand Down
Loading