Skip to content

Commit

Permalink
make updates for dbt-redshift draft
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare committed Apr 20, 2024
1 parent a8f48a2 commit 415e2d8
Show file tree
Hide file tree
Showing 7 changed files with 286 additions and 230 deletions.
92 changes: 45 additions & 47 deletions .github/actions/audit-changelog/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,56 @@ name: "Audit changelog"
description: "Get metadata about a changelog"

inputs:
version:
description: "The version whose changelog is being audited"
required: true
version:
description: "The version whose changelog is being audited"
required: true

outputs:
path:
description: "The expected file path to the change log, relative to the repo root"
value: ${{ steps.path.outputs.path }}
exists:
description: "Indicates if the changelog exists"
value: ${{ steps.exists.outputs.exists }}
path:
description: "The expected file path to the change log, relative to the repo root"
value: ${{ steps.path.outputs.path }}
exists:
description: "Indicates if the changelog exists"
value: ${{ steps.exists.outputs.exists }}

runs:
using: composite
steps:
- name: "[DEBUG] Inputs"
shell: bash
run: |
echo version : ${{ inputs.version }}
using: composite
steps:
- name: "[DEBUG] Inputs"
shell: bash
run: |
echo version : ${{ inputs.version }}
- name: "Parse version: `${{ inputs.version }}`"
id: semver
uses: dbt-labs/actions/[email protected]
with:
version: ${{ inputs.version }}
- name: "Parse version: `${{ inputs.version }}`"
id: semver
uses: dbt-labs/actions/[email protected]
with:
version: ${{ inputs.version }}

- name: "Set: path"
id: path
shell: bash
run: |
path=".changes/${{ steps.semver.outputs.base-version }}"
if [[ ${{ steps.semver.outputs.is-pre-release }} -eq 1 ]]
then
path+="-${{ steps.semver.outputs.pre-release }}"
fi
path+=".md"
echo "path=$path" >> $GITHUB_OUTPUT
- name: "Set: path"
id: path
shell: bash
run: |
path=".changes/${{ steps.semver.outputs.base-version }}"
if [[ ${{ steps.semver.outputs.is-pre-release }} -eq 1 ]]; then
path+="-${{ steps.semver.outputs.pre-release }}"
fi
path+=".md"
echo "path=$path" >> $GITHUB_OUTPUT
- name: "Set: exists"
id: exists
shell: bash
run: |
exists=false
if test -f ${{ steps.path.outputs.path }}
then
exists=true
fi
echo "exists=exists">> $GITHUB_OUTPUT
- name: "Set: exists"
id: exists
shell: bash
run: |
exists=false
if test -f ${{ steps.path.outputs.path }}; then
exists=true
fi
echo "exists=exists">> $GITHUB_OUTPUT
- name: "[DEBUG] Changelog metadata"
shell: bash
run: |
echo version : ${{ inputs.version }}
echo path : ${{ steps.path.outputs.path }}
echo exists : ${{ steps.exists.outputs.exists }}
- name: "[DEBUG] Changelog metadata"
shell: bash
run: |
echo version : ${{ inputs.version }}
echo path : ${{ steps.path.outputs.path }}
echo exists : ${{ steps.exists.outputs.exists }}
76 changes: 38 additions & 38 deletions .github/actions/audit-github-commit/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,47 @@ name: "Audit GitHub commit"
description: "Get metadata about a commit"

inputs:
sha:
description: "The commit to audit"
required: true
sha:
description: "The commit to audit"
required: true

outputs:
tag:
description: "The associated release tag, if the release exists"
value: ${{ steps.commit.outputs.tag_name }}
release-id:
description: "The associated release id, if the release exists"
value: ${{ steps.commit.outputs.id }}
pre-release:
description: "If the associated release exists, is it a pre-release?"
value: ${{ steps.commit.outputs.prerelease }}
commitish:
description: "The associated commitish, if the release exists"
value: ${{ steps.commit.outputs.target_commitish }}
tag:
description: "The associated release tag, if the release exists"
value: ${{ steps.commit.outputs.tag_name }}
release-id:
description: "The associated release id, if the release exists"
value: ${{ steps.commit.outputs.id }}
pre-release:
description: "If the associated release exists, is it a pre-release?"
value: ${{ steps.commit.outputs.prerelease }}
commitish:
description: "The associated commitish, if the release exists"
value: ${{ steps.commit.outputs.target_commitish }}

runs:
using: composite
steps:
- name: "[DEBUG] Inputs"
shell: bash
run: |
echo sha : ${{ inputs.sha }}
using: composite
steps:
- name: "[DEBUG] Inputs"
shell: bash
run: |
echo sha : ${{ inputs.sha }}
- name: "Check if a release exists for `${{ inputs.sha }}`"
id: commit
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: cardinalby/[email protected]
with:
commitSha: ${{ inputs.sha }}
doNotFailIfNotFound: true # returns blank outputs when not found instead of error
searchLimit: 15 # Since we only care about recent releases, speed up the process
- name: "Check if a release exists for `${{ inputs.sha }}`"
id: commit
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: cardinalby/[email protected]
with:
commitSha: ${{ inputs.sha }}
doNotFailIfNotFound: true # returns blank outputs when not found instead of error
searchLimit: 15 # Since we only care about recent releases, speed up the process

- name: "[DEBUG] Commit metadata"
shell: bash
run: |
echo sha : ${{ inputs.sha }}
echo tag : ${{ steps.commit.outputs.tag_name }}
echo release-id : ${{ steps.commit.outputs.id }}
echo pre-release : ${{ steps.commit.outputs.prerelease }}
echo commitish : ${{ steps.commit.outputs.target_commitish }}
- name: "[DEBUG] Commit metadata"
shell: bash
run: |
echo sha : ${{ inputs.sha }}
echo tag : ${{ steps.commit.outputs.tag_name }}
echo release-id : ${{ steps.commit.outputs.id }}
echo pre-release : ${{ steps.commit.outputs.prerelease }}
echo commitish : ${{ steps.commit.outputs.target_commitish }}
124 changes: 61 additions & 63 deletions .github/actions/audit-github-tag/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,72 @@ name: "Audit GitHub tag"
description: "Get metadata about a release tag"

inputs:
tag:
description: "The tag to audit (e.g. v1.0.0b1)"
required: true
repo-url:
description: "The URL to the repo (e.g. https://github.com/dbt-labs/dbt-adapters)"
required: true
tag:
description: "The tag to audit (e.g. v1.0.0b1)"
required: true
repo-url:
description: "The URL to the repo (e.g. https://github.com/dbt-labs/dbt-adapters)"
required: true

outputs:
exists:
description: "Indicates if the tag exists"
value: ${{ steps.tag.outputs.exists }}
sha:
description: "The commit associated with the tag if the tag exists"
value: ${{ steps.commit.outputs.sha }}
is-draft:
description: "If the tag exists, indicates if it is a draft"
value: ${{ steps.draft.outputs.is-draft }}
exists:
description: "Indicates if the tag exists"
value: ${{ steps.tag.outputs.exists }}
sha:
description: "The commit associated with the tag if the tag exists"
value: ${{ steps.commit.outputs.sha }}
is-draft:
description: "If the tag exists, indicates if it is a draft"
value: ${{ steps.draft.outputs.is-draft }}

runs:
using: composite
steps:
- name: "[DEBUG] Inputs"
shell: bash
run: |
echo tag : ${{ inputs.tag }}
echo repo-url : ${{ inputs.repo-url }}
using: composite
steps:
- name: "[DEBUG] Inputs"
shell: bash
run: |
echo tag : ${{ inputs.tag }}
echo repo-url : ${{ inputs.repo-url }}
- name: "Set: exists"
id: tag
shell: bash
run: |
output=$((gh release view ${{ inputs.tag }} --json isDraft,targetCommitish --repo ${{ inputs.repo-url }}) 2>&1) || true
echo "results=$output" >> $GITHUB_OUTPUT
if [[ "$output" == "release not found" ]]
then
echo "exists=false" >> $GITHUB_OUTPUT
else
echo "exists=true" >> $GITHUB_OUTPUT
fi
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Set: exists"
id: tag
shell: bash
run: |
output=$((gh release view ${{ inputs.tag }} --json isDraft,targetCommitish --repo ${{ inputs.repo-url }}) 2>&1) || true
echo "results=$output" >> $GITHUB_OUTPUT
if [[ "$output" == "release not found" ]]; then
echo "exists=false" >> $GITHUB_OUTPUT
else
echo "exists=true" >> $GITHUB_OUTPUT
fi
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Set: sha"
id: commit
if: ${{ fromJSON(steps.tag.outputs.exists) == true }}
shell: bash
run: |
sha=$(jq -r '.targetCommitish' <<< "${{ steps.tag.outputs.results }}")
echo "sha=$sha" >> $GITHUB_OUTPUT
- name: "Set: sha"
id: commit
if: ${{ fromJSON(steps.tag.outputs.exists) == true }}
shell: bash
run: |
sha=$(jq -r '.targetCommitish' <<< "${{ steps.tag.outputs.results }}")
echo "sha=$sha" >> $GITHUB_OUTPUT
- name: "Set: is-draft"
id: draft
if: ${{ fromJSON(steps.tag.outputs.exists) == true }}
shell: bash
run: |
is-draft=$(jq -r '.isDraft' <<< "${{ steps.tag.outputs.results }}")
if [[ $is-draft == true ]]
then
echo "is-draft=true" >> $GITHUB_OUTPUT
else
echo "is-draft=false" >> $GITHUB_OUTPUT
fi
- name: "Set: is-draft"
id: draft
if: ${{ fromJSON(steps.tag.outputs.exists) == true }}
shell: bash
run: |
is-draft=$(jq -r '.isDraft' <<< "${{ steps.tag.outputs.results }}")
if [[ $is-draft == true ]]; then
echo "is-draft=true" >> $GITHUB_OUTPUT
else
echo "is-draft=false" >> $GITHUB_OUTPUT
fi
- name: "[DEBUG] Tag metadata"
shell: bash
run: |
echo tag : ${{ inputs.tag }}
echo repo-url : ${{ inputs.repo-url }}
echo exists: : ${{ steps.release.outputs.exists }}
echo sha : ${{ steps.commit.outputs.sha }}
echo is-draft : ${{ steps.draft.outputs.is-draft }}
- name: "[DEBUG] Tag metadata"
shell: bash
run: |
echo tag : ${{ inputs.tag }}
echo repo-url : ${{ inputs.repo-url }}
echo exists: : ${{ steps.release.outputs.exists }}
echo sha : ${{ steps.commit.outputs.sha }}
echo is-draft : ${{ steps.draft.outputs.is-draft }}
Loading

0 comments on commit 415e2d8

Please sign in to comment.