Skip to content

Commit

Permalink
Merge pull request #24 from poppy-tech/main
Browse files Browse the repository at this point in the history
Fix Project setup action
  • Loading branch information
C00ldudeNoonan committed Nov 1, 2023
2 parents 97a32c8 + 3ffdf93 commit 233270e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/project_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ jobs:
with:
python-version: "3.9"

- name: Install dependencies
run: |
pip install pyyaml
- name: install requirements
run: pip install -q -r requirements.txt

- name: Add prod target to profiles.yml
run: "python update_profile_with_prod.py ${{ github.event.inputs.DatawarehouseType }}"
Expand All @@ -50,5 +49,6 @@ jobs:
commit-message: "Add prod target to profiles.yml"
branch: "add-prod-target"
base: "main"
token: ${{ secrets.WORKFLOW_TOKEN }}
body: |
This pull request adds a new target called "prod" to the `profiles.yml` file
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ The state-aware workflow will look for the `manifest.json` file in a branch call
## How To Set Up Your dbt Project

1. Fork this repo and copy your whole dbt project into the `project_goes_here` folder.
2. Update your repository settings to allow GitHub Actions to create PRs. This setting can be found in a repository's settings under Actions > General > Workflow permissions. [This is what it should look like.](https://user-images.githubusercontent.com/21294829/263915123-512bf335-6796-4ae3-a7dc-ad1cf6c4035f.png)
3. Go to the Actions tab and run the `Project Setup` workflow, making sure to select the type of database you want to set up
2. Create a [Personal Access Token](https://github.com/settings/tokens?type=beta) with Workflows (Read/Write) permission and add it to the repository action secrets with key WORKFLOW_TOKEN
3. Update your repository settings to allow GitHub Actions to create PRs. This setting can be found in a repository's settings under Actions > General > Workflow permissions. [This is what it should look like.](https://user-images.githubusercontent.com/21294829/263915123-512bf335-6796-4ae3-a7dc-ad1cf6c4035f.png)
4. Go to the Actions tab and run the `Project Setup` workflow, making sure to select the type of database you want to set up
- This opens a PR with our suggested changes to your `profiles.yml` and `requirements.txt` files.
- We assume if you're migrating to self-hosting you need to add a prod target to your `profiles.yml` file, so this action will do that for you and also add the db driver you indicate.
- FYI we also assume you have a `profiles.yml` file.
4. Add some environment variables to your GitHub Actions secrets in the Settings tab. You can see which vars are needed based on anything appended with `${{ secrets.` in the open PR. You might need to slightly edit this PR based on your project setup.
5. Run the `Manual dbt Run` to test that you're good to go.
6. Edit the Actions you want to keep and delete the ones you don't
5. Add some environment variables to your GitHub Actions secrets in the Settings tab. You can see which vars are needed based on anything appended with `${{ secrets.` in the open PR. You might need to slightly edit this PR based on your project setup.
6. Run the `Manual dbt Run` to test that you're good to go.
7. Edit the Actions you want to keep and delete the ones you don't

# dbt Documentation

Expand All @@ -34,4 +35,4 @@ If using GH Pages, the only manual configuration required for hosting your dbt d

# Acknowledgements & Notes

Thank you to [dwreeves](https://github.com/dwreeves) for both highlighting an issue with initial deployment with regard to public s3 buckets as well as providing the [template for deploying to github pages](https://github.com/dwreeves/dbt_docs_ghpages_example).
Thank you to [dwreeves](https://github.com/dwreeves) for both highlighting an issue with initial deployment with regard to public s3 buckets as well as providing the [template for deploying to github pages](https://github.com/dwreeves/dbt_docs_ghpages_example).
4 changes: 2 additions & 2 deletions update_profile_with_prod.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
'run_dbt.yml': 'run_dbt',
'run_dbt_force.yml': 'run_dbt',
'run_dbt_on_cron.yml': 'dbt_scheduled_run',
'run_dbt_on_merge.yml': 'dbt_run_on_merge',
'run_incremental_dbt_on_merge.yml': 'dbt_run_on_merge_incremental',
'run_dbt_on_pr_dev' : 'dbt_run_on_pr'
'run_dbt_on_pr.yml' : 'dbt_run_on_pr',
'run_dbt_cleanup.yml' : 'dbt_scheduled_cleanup_run'
}

# Load the profiles.yml file
Expand Down

0 comments on commit 233270e

Please sign in to comment.