GitHub CI Workflow

Step 3: Set Up the GitHub Workflow

  1. Navigate to your project repository on GitHub.

  2. Create a new directory named .github/workflows if it doesn't already exist.

  3. Inside the workflows directory, add a file named optimize-workflow.yml. You can use the scaffold provided in the configuration files you cloned earlier.

This setup leverages github actions

# set workdir as repo head
mkdir -p .github/workflows && curl -fsSL -o .github/workflows/optimize-workflow.yml

Ensure you place these files in the appropriate directories within your project repository.

Step 4: Configure Secrets

  1. Go to your repository's Settings tab, then navigate to Secrets > Actions.

  2. Create a new secret named CHICORY_TOKEN and paste your API key obtained during sign-up.

[Optional] Step 5: Specify Files for Optimization

If you want to optimize specific files that have not been modified in the pull request you can list those filenames in .chicory/override.txt.

  1. List each file as a relative path from the project root (in VSCode right click and "copy relative path")

  2. Terminate the file with an empty line

  3. The listed files will be optimized in addition to any other files that have been touched in the pull request

Chicory workflow also records reactions to the recommendations using webhooks. For setting up the webhook access:

  • Create a PAT (classic) token [admin:repo_hook] as CHICORY_PAT_WITH_ADMIN_REPO_HOOK

  • Create a new secret named CHICORY_PAT_WITH_ADMIN_REPO_HOOK and paste your PAT token.

Step 7: Trigger the Workflow

The workflow will automatically trigger on each Pull Request to the main branch of your repository. To manually test it, you can:

  1. Make a change to a SparkSQL query within your project.

  2. Commit and push the change to a new branch.

  3. Open a Pull Request to merge the changes into the main branch. The workflow will analyze the SparkSQL queries and provide optimization suggestions as comments on the Pull Request.

Chicory.AI in Action


Last updated