Skip to content

[DEV] Overwrite current env in the action #31

[DEV] Overwrite current env in the action

[DEV] Overwrite current env in the action #31

Workflow file for this run

name: Recce with dbt cloud
on:
pull_request:
branches: [main]
jobs:
check-pull-request:
name: Prepare for Recce
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
RECCE_STATE_PASSWORD: ${{ secrets.RECCE_STATE_PASSWORD }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -U recce
- name: Trigger the dbt cloud job and fetch artifacts for Recce
uses: datarecce/dbt-cloud-action@main
id: recce_dbt_cloud_run
continue-on-error: true
with:
dbt_cloud_token: ${{ secrets.DBT_CLOUD_API_TOKEN }}
dbt_cloud_account_id: 62083
dbt_cloud_base_job_id: 747906
dbt_cloud_current_job_id: 768650
git_sha: ${{ github.event.pull_request.head.sha }}
schema_override: "PR_${{ github.event.pull_request.number }}"
failure_on_error: false
- uses: "google-github-actions/auth@v2"
id: google-auth
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY_JSON }}
- name: Run dbt
run: |
pwd
tree -L 1
dbt deps
dbt docs generate --select state:modified --defer --state target-base
env:
BQ_PROJECT: ${{ steps.google-auth.outputs.project_id }}
BQ_DATASET: "PR_${{ github.event.pull_request.number }}"
BQ_KEYFILE_PATH: ${{ steps.google-auth.outputs.credentials_file_path }}
- name: Run Recce in cloud mode
run: recce run --cloud
env:
BQ_PROJECT: ${{ steps.google-auth.outputs.project_id }}
BQ_DATASET: "PR_${{ github.event.pull_request.number }}"
BQ_KEYFILE_PATH: ${{ steps.google-auth.outputs.credentials_file_path }}
- name: Prepare Recce Summary
id: recce-summary
run: |
recce summary --cloud > recce_summary.md
# Add next steps message
cat << EOF >> recce_summary.md
## Next Steps
To view detailed Recce results:
1. Checkout the PR branch: \`git checkout ${{ github.event.pull_request.head.ref }}\`
2. Launch the Recce server: \`recce server --review --cloud\`
3. Open http://localhost:8000 in your browser
EOF
# Truncate summary if it exceeds GitHub's comment size limit
if [[ $(wc -c < recce_summary.md) -ge 65535 ]]; then
truncate -s 65000 recce_summary.md
echo "
... (Summary truncated due to size limit)
For the full summary, please check the Job Summary page: ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}
" >> recce_summary.md
fi
env:
BQ_PROJECT: ${{ steps.google-auth.outputs.project_id }}
BQ_DATASET: "PR_${{ github.event.pull_request.number }}"
BQ_KEYFILE_PATH: ${{ steps.google-auth.outputs.credentials_file_path }}
- name: Comment on pull request
uses: thollander/actions-comment-pull-request@v2
with:
filePath: recce_summary.md
comment_tag: recce