Skip to content

Commit

Permalink
[Feature ] implement changie in dbt-bigquery (#253)
Browse files Browse the repository at this point in the history
* init pr for changie swap over in dbt-bigquery

* typo fix

* convert 1.3 changelog including batch and merge

* changelog entry
  • Loading branch information
McKnight-42 authored Aug 5, 2022
1 parent f1b5291 commit 64e9da7
Show file tree
Hide file tree
Showing 15 changed files with 237 additions and 135 deletions.
5 changes: 5 additions & 0 deletions .changes/0.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Previous Releases
For information on prior major and minor releases, see their changelogs:
- [1.2](https://github.com/dbt-labs/dbt-bigquery/blob/1.2.latest/CHANGELOG.md)
- [1.1](https://github.com/dbt-labs/dbt-bigquery/blob/1.1.latest/CHANGELOG.md)
- [1.0](https://github.com/dbt-labs/dbt-bigquery/blob/1.0.latest/CHANGELOG.md)
6 changes: 6 additions & 0 deletions .changes/1.3.0-b1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## dbt-bigquery 1.3.0-b1 - August 04, 2022
### Features
- Implement `create_schema` via SQL, instead of Python method, allowing users to override if desired. drop_schema remains a Python method for the time being. ([#182](https://github.com/dbt-labs/dbt-bigquery/issues/182), [#183](https://github.com/dbt-labs/dbt-bigquery/pull/183))
- Added table and incrementail materializations for python models via DataProc. ([#209](https://github.com/dbt-labs/dbt-bigquery/issues/209), [#226](https://github.com/dbt-labs/dbt-bigquery/pull/226))
### Under the Hood
- Implement minimal changes to support dbt Core incremental materialization refactor. ([#232](https://github.com/dbt-labs/dbt-bigquery/issues/232), [#223](https://github.com/dbt-labs/dbt-bigquery/pull/223))
8 changes: 8 additions & 0 deletions .changes/1.3.0/Features-20220804-154944.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
kind: Features
body: 'Implement `create_schema` via SQL, instead of Python method, allowing users
to override if desired. drop_schema remains a Python method for the time being. '
time: 2022-08-04T15:49:44.409354-05:00
custom:
Author: jtcohen6
Issue: "182"
PR: "183"
7 changes: 7 additions & 0 deletions .changes/1.3.0/Features-20220804-155057.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: Features
body: Added table and incrementail materializations for python models via DataProc.
time: 2022-08-04T15:50:57.234209-05:00
custom:
Author: stu-k
Issue: "209"
PR: "226"
7 changes: 7 additions & 0 deletions .changes/1.3.0/Under the Hood-20220804-155219.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: Under the Hood
body: Implement minimal changes to support dbt Core incremental materialization refactor.
time: 2022-08-04T15:52:19.342843-05:00
custom:
Author: gshank
Issue: "232"
PR: "223"
3 changes: 3 additions & 0 deletions .changes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# CHANGELOG

To view information about the changelog operation we suggest reading this [README](https://github.com/dbt-labs/dbt-core/blob/main/.changes/README.md) found in `dbt-core`.
6 changes: 6 additions & 0 deletions .changes/header.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# dbt-bigquery Changelog

- This file provides a full account of all changes to `dbt-bigquery`.
- Changes are listed under the (pre)release in which they first appear. Subsequent releases include changes from previous releases.
- "Breaking changes" listed under a version may require action from end users or external maintainers when upgrading to that version.
- Do not edit this file directly. This file is auto-generated using [changie](https://github.com/miniscruff/changie). For details on how to document a change, see [the contributing guide](https://github.com/dbt-labs/dbt-bigquery/blob/main/CONTRIBUTING.md#adding-changelog-entry)
Empty file added .changes/unreleased/.gitkeep
Empty file.
7 changes: 7 additions & 0 deletions .changes/unreleased/Under the Hood-20220804-155719.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: Under the Hood
body: Add changie to dbt-bigquery
time: 2022-08-04T15:57:19.060995-05:00
custom:
Author: mcknight-42
Issue: "254"
PR: "253"
60 changes: 60 additions & 0 deletions .changie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
changesDir: .changes
unreleasedDir: unreleased
headerPath: header.tpl.md
versionHeaderPath: ""
changelogPath: CHANGELOG.md
versionExt: md
versionFormat: '## dbt-bigquery {{.Version}} - {{.Time.Format "January 02, 2006"}}'
kindFormat: '### {{.Kind}}'
changeFormat: '- {{.Body}} ([#{{.Custom.Issue}}](https://github.com/dbt-labs/dbt-bigquery/issues/{{.Custom.Issue}}), [#{{.Custom.PR}}](https://github.com/dbt-labs/dbt-bigquery/pull/{{.Custom.PR}}))'
kinds:
- label: Breaking Changes
- label: Features
- label: Fixes
- label: Under the Hood
- label: Dependencies
- label: Security
custom:
- key: Author
label: GitHub Username(s) (separated by a single space if multiple)
type: string
minLength: 3
- key: Issue
label: GitHub Issue Number
type: int
minLength: 4
- key: PR
label: GitHub Pull Request Number
type: int
minLength: 4
footerFormat: |
{{- $contributorDict := dict }}
{{- /* any names added to this list should be all lowercase for later matching purposes */}}
{{- $core_team := list "emmyoop" "nathaniel-may" "gshank" "leahwicz" "chenyulinx" "stu-k" "iknox-fa" "versusfacit" "mcknight-42" "jtcohen6" "dependabot[bot]" "snyk-bot" }}
{{- range $change := .Changes }}
{{- $authorList := splitList " " $change.Custom.Author }}
{{- /* loop through all authors for a PR */}}
{{- range $author := $authorList }}
{{- $authorLower := lower $author }}
{{- /* we only want to include non-core team contributors */}}
{{- if not (has $authorLower $core_team)}}
{{- $pr := $change.Custom.PR }}
{{- /* check if this contributor has other PRs associated with them already */}}
{{- if hasKey $contributorDict $author }}
{{- $prList := get $contributorDict $author }}
{{- $prList = append $prList $pr }}
{{- $contributorDict := set $contributorDict $author $prList }}
{{- else }}
{{- $prList := list $change.Custom.PR }}
{{- $contributorDict := set $contributorDict $author $prList }}
{{- end }}
{{- end}}
{{- end}}
{{- end }}
{{- /* no indentation here for formatting so the final markdown doesn't have unneeded indentations */}}
{{- if $contributorDict}}
### Contributors
{{- range $k,$v := $contributorDict }}
- [@{{$k}}](https://github.com/{{$k}}) ({{ range $index, $element := $v }}{{if $index}}, {{end}}[#{{$element}}](https://github.com/dbt-labs/dbt-bigquery/pull/{{$element}}){{end}})
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ resolves #
- [ ] I have signed the [CLA](https://docs.getdbt.com/docs/contributor-license-agreements)
- [ ] I have run this code in development and it appears to resolve the stated issue
- [ ] This PR includes tests, or tests are not required/relevant for this PR
- [ ] I have updated the `CHANGELOG.md` and added information about my change to the "dbt-bigquery next" section.
- [ ] I have run `changie new` to [create a changelog entry](https://github.com/dbt-labs/dbt-core/blob/main/CONTRIBUTING.md#Adding-CHANGELOG-Entry)
61 changes: 61 additions & 0 deletions .github/workflows/bot-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# **what?**
# When bots create a PR, this action will add a corresponding changie yaml file to that
# PR when a specific label is added.
#
# The file is created off a template:
#
# kind: <per action matrix>
# body: <PR title>
# time: <current timestamp>
# custom:
# Author: <PR User Login (generally the bot)>
# Issue: 4904
# PR: <PR number>
#
# **why?**
# Automate changelog generation for more visability with automated bot PRs.
#
# **when?**
# Once a PR is created, label should be added to PR before or after creation. You can also
# manually trigger this by adding the appropriate label at any time.
#
# **how to add another bot?**
# Add the label and changie kind to the include matrix. That's it!
#

name: Bot Changelog

on:
pull_request:
# catch when the PR is opened with the label or when the label is added
types: [opened, labeled]

permissions:
contents: write
pull-requests: read

jobs:
generate_changelog:
strategy:
matrix:
include:
- label: "dependencies"
changie_kind: "Dependency"
- label: "snyk"
changie_kind: "Security"
runs-on: ubuntu-latest

steps:

- name: Create and commit changelog on bot PR
if: "contains(github.event.pull_request.labels.*.name, ${{ matrix.label }})"
id: bot_changelog
uses: emmyoop/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.FISHTOWN_BOT_PAT }}
commit_author_name: "Github Build Bot"
commit_author_email: "<[email protected]>"
commit_message: "Add automated changelog yaml from template for bot PR"
changie_kind: ${{ matrix.changie_kind }}
label: ${{ matrix.label }}
custom_changelog_string: "custom:\n Author: ${{ github.event.pull_request.user.login }}\n Issue: 216\n PR: ${{ github.event.pull_request.number }}\n"
41 changes: 41 additions & 0 deletions .github/workflows/changelog-existence.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# **what?**
# Checks that a file has been committed under the /.changes directory
# as a new CHANGELOG entry. Cannot check for a specific filename as
# it is dynamically generated by change type and timestamp.
# This workflow should not require any secrets since it runs for PRs
# from forked repos.
# By default, secrets are not passed to workflows running from
# a forked repo.

# **why?**
# Ensure code change gets reflected in the CHANGELOG.

# **when?**
# This will run for all PRs going into main and *.latest. It will
# run when they are opened, reopened, when any label is added or removed
# and when new code is pushed to the branch. The action will then get
# skipped if the 'Skip Changelog' label is present is any of the labels.

name: Check Changelog Entry

on:
pull_request:
types: [opened, reopened, labeled, unlabeled, synchronize]
workflow_dispatch:

defaults:
run:
shell: bash

permissions:
contents: read
pull-requests: write


jobs:
changelog:
uses: dbt-labs/actions/.github/workflows/changelog-existence.yml@main
with:
changelog_comment: 'Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see [the dbt-core contributing guide](https://github.com/dbt-labs/dbt-core/blob/main/CONTRIBUTING.md#adding-changelog-entry), and the [dbt-bigquery contriubuting guide](https://github.com/dbt-labs/dbt-bigquery/blob/main/CONTRIBUTING.MD).'
skip_label: 'Skip Changelog'
secrets: inherit # this is only acceptable because we own the action we're calling
Loading

0 comments on commit 64e9da7

Please sign in to comment.