Skip to content

Chore: Migrate to private ddn #60

Chore: Migrate to private ddn

Chore: Migrate to private ddn #60

Workflow file for this run

name: Create PromptQL Build
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- "pql/**"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Load secrets from 1Password
uses: 1password/load-secrets-action@v1
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
HASURA_DDN_PAT: "op://Product ACT/pql-docs-bot/hasura-ddn-pat"
ANTHROPIC_KEY: "op://Product ACT/pql-docs-bot/anthropic-api-key"
APP_PG_JDBC_URL: "op://Product ACT/pql-docs-bot/postgres-jdbc-url"
APP_PG_JDBC_SCHEMAS: "op://Product ACT/pql-docs-bot/postgres-jdbc-schemas"
APP_TS_OPENAI_API_KEY: "op://Product ACT/pql-docs-bot/openai-api-key"
APP_TS_PG_DATABASE_URL: "op://Product ACT/pql-docs-bot/postgres-database-url"
JWT_SECRET: "op://Product ACT/pql-docs-bot/jwt-secret"
- name: Install DDN CLI
run: |
curl -L https://graphql-engine-cdn.hasura.io/ddn/cli/v4/get.sh | bash
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Verify DDN CLI installation
run: ddn --version
- name: Authenticate with Hasura DDN
run: |
cd pql
ddn auth login --pat "$HASURA_DDN_PAT"
- name: Create temp .env.cloud file
run: |
cd pql
cat > .env.cloud << EOF
HASURA_DDN_PAT=$HASURA_DDN_PAT
ANTHROPIC_KEY=$ANTHROPIC_KEY
APP_PG_JDBC_URL=$APP_PG_JDBC_URL
APP_PG_JDBC_SCHEMAS=$APP_PG_JDBC_SCHEMAS
APP_TS_OPENAI_API_KEY=$APP_TS_OPENAI_API_KEY
APP_TS_PG_DATABASE_URL=$APP_TS_PG_DATABASE_URL
JWT_SECRET=$JWT_SECRET
EOF
- name: Create DDN build
id: build
run: |
cd pql
BUILD_OUTPUT=$(ddn supergraph build create --out json -d "PR #${{ github.event.number }}: ${{ github.event.pull_request.title }}")
echo "build_output<<EOF" >> $GITHUB_OUTPUT
echo "$BUILD_OUTPUT" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Comment on PR
if: always()
uses: actions/github-script@v7
with:
script: |
const buildOutput = JSON.parse(`${{ steps.build.outputs.build_output }}`);
const comment = `## 🚀 PromptQL Build Complete
**Build Version:** \`${buildOutput.build_version || 'N/A'}\`
**Project:** \`${buildOutput.project_name || 'pql-docs'}\`
**PromptQL Playground:** ${buildOutput.promptql_url ? `[Open Playground](${buildOutput.promptql_url})` : 'N/A'}
${buildOutput.description ? `\n**Description:** ${buildOutput.description}` : ''}
`;
// Find existing comment
const comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
const existingComment = comments.data.find(comment =>
comment.body.includes('🚀 PromptQL Build Complete')
);
if (existingComment) {
// Update existing comment
await github.rest.issues.updateComment({
comment_id: existingComment.id,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
} else {
// Create new comment
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
}