mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-12-03 08:10:27 +00:00
* chore: scope claude action tokens and reviewer context to the pr Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: remove unused /demo and /plan comment commands Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: find claude reviews posted with the job token in review rounds Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: remove unused /ai comment command Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: pass workflow inputs through env and skip ee checkout for fork reviews Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: remove unused linear claude workflow Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: bound reviewer comment fetch and allow the code navigator Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
273 lines
10 KiB
YAML
273 lines
10 KiB
YAML
name: Git commands
|
|
|
|
on:
|
|
issue_comment:
|
|
types: [created]
|
|
|
|
jobs:
|
|
# /command comments can come from anyone; author_association misses private org
|
|
# members, so check-access resolves them via the internal app token. Runs once and is
|
|
# OR'd into each job's guard (public members still pass on author_association alone).
|
|
check-access:
|
|
if: github.event.issue.pull_request != null && startsWith(github.event.comment.body, '/')
|
|
uses: ./.github/workflows/check-write-access.yml
|
|
with:
|
|
username: ${{ github.event.comment.user.login }}
|
|
secrets: inherit
|
|
|
|
update-sqlx:
|
|
needs: [check-access]
|
|
if: >-
|
|
github.event.issue.pull_request &&
|
|
(contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) || needs.check-access.outputs.authorized == 'true') &&
|
|
startsWith(github.event.comment.body, '/updatesqlx')
|
|
runs-on: ubicloud-standard-8
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
issues: write
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16
|
|
env:
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_DB: windmill
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
|
|
steps:
|
|
- uses: actions/create-github-app-token@v2.2.2
|
|
id: app
|
|
with:
|
|
app-id: ${{ vars.INTERNAL_APP_ID }}
|
|
private-key: ${{ secrets.INTERNAL_APP_KEY }}
|
|
|
|
- name: Comment on PR - Starting
|
|
uses: actions/github-script@v6.4.1
|
|
with:
|
|
github-token: ${{ steps.app.outputs.token }}
|
|
script: |
|
|
const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
|
|
github.rest.issues.createComment({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
body: `Starting sqlx update...\n\n[View workflow run](${runUrl})`
|
|
})
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3.7.0
|
|
with:
|
|
token: ${{ steps.app.outputs.token }}
|
|
ref: ${{ github.event.issue.pull_request.head.ref }}
|
|
fetch-depth: 0
|
|
|
|
- name: Checkout windmill-ee-private
|
|
uses: actions/checkout@v3.7.0
|
|
with:
|
|
repository: windmill-labs/windmill-ee-private
|
|
path: windmill-ee-private
|
|
token: ${{ secrets.WINDMILL_EE_PRIVATE_ACCESS }}
|
|
|
|
# Setup Rust toolchain
|
|
- uses: actions-rust-lang/setup-rust-toolchain@v1.17.0
|
|
with:
|
|
cache-workspaces: backend
|
|
toolchain: 1.97.0
|
|
|
|
- name: Install xmlsec and gssapi build-time deps
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends \
|
|
pkg-config libxml2-dev libssl-dev libkrb5-dev libsasl2-dev libcurl4-openssl-dev mold clang \
|
|
xmlsec1 libxmlsec1-dev libxmlsec1-openssl
|
|
|
|
- name: Run update-sqlx script
|
|
env:
|
|
DATABASE_URL: postgres://postgres:postgres@localhost:5432/windmill
|
|
GH_TOKEN: ${{ steps.app.outputs.token }}
|
|
run: |
|
|
set -e # Exit on any command failure
|
|
PR_NUMBER=${{ github.event.issue.number }}
|
|
|
|
# Set up error trap to comment on PR for any failure
|
|
trap 'gh pr comment $PR_NUMBER --body "❌ SQLx update failed. Please check the workflow logs for details."' ERR
|
|
|
|
BRANCH_NAME=$(gh pr view $PR_NUMBER --json headRefName --jq .headRefName)
|
|
echo "Checking out PR branch: $BRANCH_NAME"
|
|
git checkout $BRANCH_NAME
|
|
git config --local user.email "windmill-internal-app[bot]@users.noreply.github.com"
|
|
git config --local user.name "windmill-internal-app[bot]"
|
|
git config pull.rebase true
|
|
git pull origin $BRANCH_NAME
|
|
|
|
# Checkout the correct windmill-ee-private commit from ee-repo-ref.txt
|
|
if [ -f backend/ee-repo-ref.txt ]; then
|
|
EE_REF=$(cat backend/ee-repo-ref.txt | tr -d '[:space:]')
|
|
echo "Checking out windmill-ee-private at commit: $EE_REF"
|
|
cd windmill-ee-private
|
|
git fetch origin $EE_REF
|
|
git checkout $EE_REF
|
|
cd ..
|
|
else
|
|
echo "Warning: ee-repo-ref.txt not found, using default branch"
|
|
fi
|
|
|
|
mkdir -p frontend/build
|
|
cd backend
|
|
cargo install sqlx-cli --version 0.8.5
|
|
sqlx migrate run
|
|
./substitute_ee_code.sh --dir ./windmill-ee-private
|
|
./update_sqlx.sh
|
|
# Pass the branch name to the next step
|
|
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
|
|
|
|
- name: Commit changes if any
|
|
run: |
|
|
git add backend/.sqlx
|
|
git commit -m "Update SQLx metadata"
|
|
git push origin "$BRANCH_NAME"
|
|
|
|
- name: Comment on PR - Completed
|
|
uses: actions/github-script@v6.4.1
|
|
with:
|
|
github-token: ${{ steps.app.outputs.token }}
|
|
script: |
|
|
github.rest.issues.createComment({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
body: 'Successfully ran sqlx update'
|
|
})
|
|
|
|
update-ee-ref:
|
|
needs: [check-access]
|
|
if: >-
|
|
github.event.issue.pull_request &&
|
|
(contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) || needs.check-access.outputs.authorized == 'true') &&
|
|
startsWith(github.event.comment.body, '/eeref')
|
|
runs-on: ubicloud-standard-2
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
issues: write
|
|
steps:
|
|
- uses: actions/create-github-app-token@v2.2.2
|
|
id: app
|
|
with:
|
|
app-id: ${{ vars.INTERNAL_APP_ID }}
|
|
private-key: ${{ secrets.INTERNAL_APP_KEY }}
|
|
|
|
- name: Comment on PR - Starting
|
|
uses: actions/github-script@v6.4.1
|
|
with:
|
|
github-token: ${{ steps.app.outputs.token }}
|
|
script: |
|
|
const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
|
|
github.rest.issues.createComment({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
body: `Starting ee ref update...\n\n[View workflow run](${runUrl})`
|
|
})
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3.7.0
|
|
with:
|
|
token: ${{ steps.app.outputs.token }}
|
|
ref: ${{ github.event.issue.pull_request.head.ref }}
|
|
fetch-depth: 0
|
|
|
|
- name: Checkout windmill-ee-private
|
|
uses: actions/checkout@v3.7.0
|
|
with:
|
|
repository: windmill-labs/windmill-ee-private
|
|
path: windmill-ee-private
|
|
token: ${{ secrets.WINDMILL_EE_PRIVATE_ACCESS }}
|
|
|
|
- name: Get last commit hash of private-repo
|
|
id: get-commit-hash
|
|
run: |
|
|
cd windmill-ee-private
|
|
COMMIT_HASH=$(git rev-parse HEAD)
|
|
echo "commit_hash=$COMMIT_HASH" >> $GITHUB_OUTPUT
|
|
echo "Latest commit hash: $COMMIT_HASH"
|
|
|
|
- name: Update ee-repo-ref.txt
|
|
env:
|
|
GH_TOKEN: ${{ steps.app.outputs.token }}
|
|
run: |
|
|
set -e # Exit on any command failure
|
|
PR_NUMBER=${{ github.event.issue.number }}
|
|
|
|
# Set up error trap to comment on PR for any failure
|
|
trap 'gh pr comment $PR_NUMBER --body "❌ EE ref update failed. Please check the workflow logs for details."' ERR
|
|
|
|
BRANCH_NAME=$(gh pr view $PR_NUMBER --json headRefName --jq .headRefName)
|
|
echo "Checking out PR branch: $BRANCH_NAME"
|
|
git checkout $BRANCH_NAME
|
|
git config --local user.email "windmill-internal-app[bot]@users.noreply.github.com"
|
|
git config --local user.name "windmill-internal-app[bot]"
|
|
git config pull.rebase true
|
|
git pull origin $BRANCH_NAME
|
|
echo "${{ steps.get-commit-hash.outputs.commit_hash }}" > backend/ee-repo-ref.txt
|
|
echo "Updated backend/ee-repo-ref.txt with commit hash: ${{ steps.get-commit-hash.outputs.commit_hash }}"
|
|
# commit and push the changes
|
|
git add backend/ee-repo-ref.txt
|
|
git commit -m "Update ee-repo-ref.txt" || echo "No changes to commit"
|
|
git push origin $BRANCH_NAME
|
|
|
|
- name: Comment on PR - Completed
|
|
uses: actions/github-script@v6.4.1
|
|
with:
|
|
github-token: ${{ steps.app.outputs.token }}
|
|
script: |
|
|
github.rest.issues.createComment({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
body: 'Successfully updated ee-repo-ref.txt'
|
|
})
|
|
|
|
update-docs:
|
|
needs: [check-access]
|
|
if: >-
|
|
github.event.issue.pull_request &&
|
|
(contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) || needs.check-access.outputs.authorized == 'true') &&
|
|
startsWith(github.event.comment.body, '/docs')
|
|
runs-on: ubicloud-standard-2
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
issues: read
|
|
steps:
|
|
- uses: actions/create-github-app-token@v2.2.2
|
|
id: app
|
|
with:
|
|
app-id: ${{ vars.INTERNAL_APP_ID }}
|
|
private-key: ${{ secrets.INTERNAL_APP_KEY }}
|
|
owner: ${{ github.repository_owner }}
|
|
repositories: |
|
|
windmilldocs
|
|
|
|
- name: Trigger docs update
|
|
env:
|
|
GH_TOKEN: ${{ steps.app.outputs.token }}
|
|
COMMENT_TEXT: ${{ github.event.comment.body }}
|
|
run: |
|
|
jq -n \
|
|
--argjson pr_number ${{ github.event.issue.number }} \
|
|
--arg repo "${{ github.event.repository.name }}" \
|
|
--arg comment "$COMMENT_TEXT" \
|
|
'{event_type: "create-docs", client_payload: {pr_number: $pr_number, repo: $repo, comment_text: $comment}}' | \
|
|
gh api repos/windmill-labs/windmilldocs/dispatches \
|
|
--method POST \
|
|
--input -
|