diff --git a/.github/_README.md b/.github/_README.md index cebe2f2e01e..4da081fe2b6 100644 --- a/.github/_README.md +++ b/.github/_README.md @@ -143,19 +143,21 @@ Some triggers of note that we use: - Print out all variables you will reference as the first step of a job. This allows for easier debugging. The first job should log all inputs. Subsequent jobs should reference outputs of other jobs, if present. - When possible, generate variables at the top of your workflow in a single place to reference later. This is not always strictly possible since you may generate a value to be used lated mid-workflow. + When possible, generate variables at the top of your workflow in a single place to reference later. This is not always strictly possible since you may generate a value to be used later mid-workflow. + + Be sure to use quotes around these logs so special characters are not interpreted. ```yaml job1: - - name: [DEBUG] Print Variables + - name: "[DEBUG] Print Variables" run: | echo "all variables defined as inputs" - echo The last commit sha in the release: ${{ inputs.sha }} - echo The release version number: ${{ inputs.version_number }} - echo The changelog_path: ${{ inputs.changelog_path }} - echo The build_script_path: ${{ inputs.build_script_path }} - echo The s3_bucket_name: ${{ inputs.s3_bucket_name }} - echo The package_test_command: ${{ inputs.package_test_command }} + echo "The last commit sha in the release: ${{ inputs.sha }}" + echo "The release version number: ${{ inputs.version_number }}" + echo "The changelog_path: ${{ inputs.changelog_path }}" + echo "The build_script_path: ${{ inputs.build_script_path }}" + echo "The s3_bucket_name: ${{ inputs.s3_bucket_name }}" + echo "The package_test_command: ${{ inputs.package_test_command }}" # collect all the variables that need to be used in subsequent jobs - name: Set Variables @@ -167,7 +169,7 @@ Some triggers of note that we use: job2: needs: [job1] - - name: '[DEBUG] Print Variables' + - name: "[DEBUG] Print Variables" run: | echo "all variables defined in job1 > Set Variables > outputs" echo "important_path: ${{ needs.job1.outputs.important_path }}" diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml deleted file mode 100644 index cb955bc8d38..00000000000 --- a/.github/workflows/changelog-check.yml +++ /dev/null @@ -1,78 +0,0 @@ -# **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 - -env: - 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 contributing guide](https://github.com/dbt-labs/dbt-core/blob/main/CONTRIBUTING.md#adding-changelog-entry).' - -jobs: - changelog: - name: changelog - if: "!contains(github.event.pull_request.labels.*.name, 'Skip Changelog')" - - runs-on: ubuntu-latest - - steps: - - name: Check if changelog file was added - # https://github.com/marketplace/actions/paths-changes-filter - # For each filter, it sets output variable named by the filter to the text: - # 'true' - if any of changed files matches any of filter rules - # 'false' - if none of changed files matches any of filter rules - # also, returns: - # `changes` - JSON array with names of all filters matching any of the changed files - uses: dorny/paths-filter@v2 - id: filter - with: - token: ${{ secrets.GITHUB_TOKEN }} - filters: | - changelog: - - added: '.changes/unreleased/**.yaml' - - name: Check if comment already exists - uses: peter-evans/find-comment@v1 - id: changelog_comment - with: - issue-number: ${{ github.event.pull_request.number }} - comment-author: 'github-actions[bot]' - body-includes: ${{ env.changelog_comment }} - - name: Create PR comment if changelog entry is missing, required, and does not exist - if: | - steps.filter.outputs.changelog == 'false' && - steps.changelog_comment.outputs.comment-body == '' - uses: peter-evans/create-or-update-comment@v1 - with: - issue-number: ${{ github.event.pull_request.number }} - body: ${{ env.changelog_comment }} - - name: Fail job if changelog entry is missing and required - if: steps.filter.outputs.changelog == 'false' - uses: actions/github-script@v6 - with: - script: core.setFailed('Changelog entry required to merge.') diff --git a/.github/workflows/changelog-existence.yml b/.github/workflows/changelog-existence.yml new file mode 100644 index 00000000000..7be8c1accb5 --- /dev/null +++ b/.github/workflows/changelog-existence.yml @@ -0,0 +1,40 @@ +# **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 contributing guide](https://github.com/dbt-labs/dbt-core/blob/main/CONTRIBUTING.md#adding-changelog-entry).' + skip_label: 'Skip Changelog' + secrets: inherit