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
42 changes: 33 additions & 9 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,42 @@ jobs:
- name: Get preview url
id: get_url
run: |
STATE="not ready"
CURRENT_HASH=${{ github.event.pull_request.head.sha }}
echo $CURRENT_HASH
until [ "$STATE" = '"READY"' ]
echo "Looking for deployment for commit: $CURRENT_HASH"

MAX_ATTEMPTS=60 # 5 minutes maximum wait time
ATTEMPT=0

while [ $ATTEMPT -lt $MAX_ATTEMPTS ]
do
RESULTS=$(curl -s -H 'Accept: application/json' -H "Authorization: Bearer ${{ secrets.VERCEL_TOKEN }}" "https://api.vercel.com/v6/now/deployments?teamId=tone-row&name=flowchart-fun")
CLEAN=$(echo $RESULTS | tr -d '[:cntrl:]');
STATE=$(echo $CLEAN | jq --arg h "$CURRENT_HASH" '.deployments[] | select(.meta.githubCommitSha==$h) | .state');
echo $STATE
CLEAN=$(echo $RESULTS | tr -d '[:cntrl:]')

# Check if there's any READY deployment for this commit
READY_URL=$(echo $CLEAN | jq --arg h "$CURRENT_HASH" -r '.deployments[] | select(.meta.githubCommitSha==$h and .state=="READY") | .url' | head -n1)

if [ ! -z "$READY_URL" ]; then
echo "Found ready deployment!"
echo "preview_url=https://$READY_URL" >> $GITHUB_OUTPUT
exit 0
fi

# If no READY deployment found, check if all deployments for this commit have errored
ALL_STATES=$(echo $CLEAN | jq --arg h "$CURRENT_HASH" -r '.deployments[] | select(.meta.githubCommitSha==$h) | .state')

if [ ! -z "$ALL_STATES" ] && [ -z "$(echo "$ALL_STATES" | grep -v "ERROR")" ]; then
echo "All deployments have failed for this commit"
exit 1
fi

echo "Waiting for deployment... (Attempt $ATTEMPT of $MAX_ATTEMPTS)"
ATTEMPT=$((ATTEMPT + 1))
sleep 5
done
echo "Deployment is ready!"
URL=https://$(echo $CLEAN | jq --arg h "$CURRENT_HASH" '.deployments[] | select(.meta.githubCommitSha==$h) | .url')
echo ::set-output name=preview_url::$(echo $URL)

echo "Timeout waiting for deployment"
exit 1

- name: Checkout Code
uses: actions/checkout@v4
- name: Add env
Expand All @@ -37,6 +59,8 @@ jobs:
echo TESTING_PASS_PRO=${{ secrets.TESTING_PASS_PRO }} >> app/.env
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"
- uses: pnpm/action-setup@v3
with:
version: 8
Expand Down
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"axios": "^0.27.2",
"csv-parse": "^5.3.6",
"date-fns": "^2.29.3",
"graph-selector": "^0.11.1",
"graph-selector": "^0.13.0",
"highlight.js": "^11.8.0",
"marked": "^4.1.1",
"micro": "^10.0.1",
Expand Down
14 changes: 7 additions & 7 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "app",
"version": "1.61.3",
"version": "1.61.4",
"main": "module/module.js",
"license": "MIT",
"scripts": {
Expand Down Expand Up @@ -66,10 +66,10 @@
"classnames": "^2.3.2",
"construct-style-sheets-polyfill": "^3.1.0",
"core-js": "^3.18.1",
"cytoscape": "^3.29.2",
"cytoscape": "^3.31.0",
"cytoscape-cose-bilkent": "^4.1.0",
"cytoscape-dagre": "^2.5.0",
"cytoscape-elk": "^2.1.0",
"cytoscape-elk": "^2.3.0",
"cytoscape-fcose": "^2.2.0",
"cytoscape-grid-guide": "^2.3.3",
"cytoscape-klay": "^3.1.4",
Expand All @@ -81,7 +81,7 @@
"file-saver": "^2.0.5",
"formulaic": "workspace:*",
"framer-motion": "^10.13.1",
"graph-selector": "^0.11.2",
"graph-selector": "^0.13.0",
"gray-matter": "^4.0.2",
"highlight.js": "^11.7.0",
"immer": "^9.0.16",
Expand All @@ -99,7 +99,7 @@
"papaparse": "^5.4.1",
"phosphor-react": "^1.3.1",
"postcss-flexbugs-fixes": "^5.0.2",
"posthog-js": "^1.203.1",
"posthog-js": "^1.211.2",
"prettier": "^2.3.1",
"re-resizable": "^6.9.0",
"react": "^18.2.0",
Expand Down Expand Up @@ -151,8 +151,8 @@
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"@types/css-font-loading-module": "^0.0.7",
"@types/cytoscape": "^3.21.1",
"@types/cytoscape-fcose": "^2.2.2",
"@types/cytoscape": "^3.21.9",
"@types/cytoscape-fcose": "^2.2.4",
"@types/download": "^6.2.4",
"@types/file-saver": "^2.0.1",
"@types/jest": "^29.0.0",
Expand Down
6 changes: 5 additions & 1 deletion app/src/components/PosthogWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ const options: Partial<PostHogConfig> = {
};

export function PosthogWrapper({ children }: { children: React.ReactNode }) {
if (process.env.REACT_APP_VERCEL_ENV !== "production") {
if (
process.env.REACT_APP_VERCEL_ENV !== "production" ||
!process.env.REACT_APP_PUBLIC_POSTHOG_KEY ||
!process.env.REACT_APP_PUBLIC_POSTHOG_HOST
) {
return <>{children}</>;
}

Expand Down
Loading
Loading