Skip to content

Commit

Permalink
Merge branch 'current' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewshaver authored Nov 8, 2024
2 parents ab33842 + e9c141e commit c98a03a
Show file tree
Hide file tree
Showing 575 changed files with 84,395 additions and 10,590 deletions.
20 changes: 10 additions & 10 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
## What are you changing in this pull request and why?
<!---
Describe your changes and why you're making them. If related to an open
issue or a pull request on dbt Core, then link to them here!
<!--
Describe your changes and why you're making them. If related to an open issue or a pull request on dbt Core or another repository, then link to them here!
To learn more about the writing conventions used in the dbt Labs docs, see the [Content style guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md).
-->

## Checklist
- [ ] I have reviewed the [Content style guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md) so my content adheres to these guidelines.
- [ ] The topic I'm writing about is for specific dbt version(s) and I have versioned it according to the [version a whole page](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#adding-a-new-version) and/or [version a block of content](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-blocks-of-content) guidelines.
- [ ] I have added checklist item(s) to this list for anything anything that needs to happen before this PR is merged, such as "needs technical review" or "change base branch."
- [ ] The content in this PR requires a dbt release note, so I added one to the [release notes page](https://docs.getdbt.com/docs/dbt-versions/dbt-cloud-release-notes).
<!--
Uncomment when publishing docs for a prerelease version of dbt:
- [ ] Add versioning components, as described in [Versioning Docs](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-entire-pages)
PRE-RELEASE VERSION OF dbt (if so, uncomment):
- [ ] Add a note to the prerelease version [Migration Guide](https://github.com/dbt-labs/docs.getdbt.com/tree/current/website/docs/docs/dbt-versions/core-upgrade)
-->
- [ ] Review the [Content style guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md) so my content adheres to these guidelines.
- [ ] For [docs versioning](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#about-versioning), review how to [version a whole page](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#adding-a-new-version) and [version a block of content](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-blocks-of-content).
- [ ] Add a checklist item for anything that needs to happen before this PR is merged, such as "needs technical review" or "change base branch."

Adding or removing pages (delete if not applicable):
<!--
ADDING OR REMOVING PAGES (if so, uncomment):
- [ ] Add/remove page in `website/sidebars.js`
- [ ] Provide a unique filename for new pages
- [ ] Add an entry for deleted pages in `website/vercel.json`
- [ ] Run link testing locally with `npm run build` to update the links that point to deleted pages
-->
169 changes: 169 additions & 0 deletions .github/workflows/preview-link.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
name: Vercel deployment preview link generator

on:
pull_request:
types: [opened, synchronize]
paths:
- 'website/docs/docs/**'
- 'website/docs/best-practices/**'
- 'website/docs/guides/**'
- 'website/docs/faqs/**'
- 'website/docs/reference/**'

permissions:
contents: write
pull-requests: write

jobs:
update-pr-description:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install necessary tools
run: |
sudo apt-get update
sudo apt-get install -y jq curl
- name: Generate Vercel deployment URL
id: vercel_url
run: |
# Get the branch name
BRANCH_NAME="${{ github.head_ref }}"
# Convert to lowercase
BRANCH_NAME_LOWER=$(echo "$BRANCH_NAME" | tr '[:upper:]' '[:lower:]')
# Replace non-alphanumeric characters with hyphens
BRANCH_NAME_SANITIZED=$(echo "$BRANCH_NAME_LOWER" | sed 's/[^a-z0-9]/-/g')
# Construct the deployment URL
DEPLOYMENT_URL="https://docs-getdbt-com-git-${BRANCH_NAME_SANITIZED}-dbt-labs.vercel.app"
echo "deployment_url=$DEPLOYMENT_URL" >> $GITHUB_OUTPUT
- name: Wait for deployment to be accessible
id: wait_for_deployment
run: |
DEPLOYMENT_URL="${{ steps.vercel_url.outputs.deployment_url }}"
echo "Waiting for deployment at $DEPLOYMENT_URL to become accessible..."
MAX_ATTEMPTS=60 # Wait up to 10 minutes
SLEEP_TIME=10 # Check every 10 seconds
ATTEMPTS=0
while [ $ATTEMPTS -lt $MAX_ATTEMPTS ]; do
STATUS_CODE=$(curl -s -o /dev/null -w "%{http_code}" "$DEPLOYMENT_URL")
if [ "$STATUS_CODE" -eq 200 ]; then
echo "Deployment is accessible."
break
else
echo "Deployment not yet accessible (status code: $STATUS_CODE). Waiting..."
sleep $SLEEP_TIME
ATTEMPTS=$((ATTEMPTS + 1))
fi
done
if [ $ATTEMPTS -eq $MAX_ATTEMPTS ]; then
echo "Deployment did not become accessible within the expected time."
exit 1
fi
- name: Get changed files
id: files
run: |
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -E '^website/docs/(docs|best-practices|guides|faqs|reference)/.*\.md$' || true)
if [ -z "$CHANGED_FILES" ]; then
echo "No documentation files were changed."
echo "changed_files=" >> $GITHUB_OUTPUT
else
CHANGED_FILES=$(echo "$CHANGED_FILES" | tr '\n' ' ')
echo "changed_files=$CHANGED_FILES" >> $GITHUB_OUTPUT
fi
- name: Generate file preview links
id: links
run: |
DEPLOYMENT_URL="${{ steps.vercel_url.outputs.deployment_url }}"
CHANGED_FILES="${{ steps.files.outputs.changed_files }}"
if [ -z "$CHANGED_FILES" ]; then
echo "No changed files found in the specified directories."
LINKS="No documentation files were changed."
else
LINKS=""
# Convert CHANGED_FILES back to newline-separated for processing
CHANGED_FILES=$(echo "$CHANGED_FILES" | tr ' ' '\n')
for FILE in $CHANGED_FILES; do
# Remove 'website/docs/' prefix
FILE_PATH="${FILE#website/docs/}"
# Remove the .md extension
FILE_PATH="${FILE_PATH%.md}"
# Construct the full URL
FULL_URL="$DEPLOYMENT_URL/$FILE_PATH"
LINKS="$LINKS\n- $FULL_URL"
done
fi
# Properly set the multi-line output
echo "links<<EOF" >> $GITHUB_OUTPUT
echo -e "$LINKS" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Update PR description with deployment links
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const prNumber = context.issue.number;
// Fetch the current PR description
const { data: pullRequest } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
});
let body = pullRequest.body || '';
// Define the markers
const startMarker = '<!-- vercel-deployment-preview -->';
const endMarker = '<!-- end-vercel-deployment-preview -->';
// Get the deployment URL and links from environment variables
const deploymentUrl = process.env.DEPLOYMENT_URL;
const links = process.env.LINKS;
// Build the deployment content without leading whitespace
const deploymentContent = [
`${startMarker}`,
'---',
'🚀 Deployment available! Here are the direct links to the updated files:',
'',
`${links}`,
'',
`${endMarker}`
].join('\n');
// Remove existing deployment content between markers
const regex = new RegExp(`${startMarker}[\\s\\S]*?${endMarker}`, 'g');
body = body.replace(regex, '').trim();
// Append the new deployment content
body = `${body}\n\n${deploymentContent}`;
// Update the PR description
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
body: body,
});
env:
DEPLOYMENT_URL: ${{ steps.vercel_url.outputs.deployment_url }}
LINKS: ${{ steps.links.outputs.links }}
80 changes: 80 additions & 0 deletions .github/workflows/vale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Vale linting

on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'website/docs/**/*'
- 'website/blog/**/*'
- 'website/**/*'

jobs:
vale:
name: Vale linting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: List repository contents
run: |
pwd
ls -R
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install Vale
run: pip install vale==2.27.0 # Install a stable version of Vale

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v34
with:
files: |
website/**/*.md
separator: ' '

- name: Debugging - Print changed files
if: ${{ steps.changed-files.outputs.any_changed == 'true' }}
run: |
echo "Changed files:"
echo "${{ steps.changed-files.outputs.all_changed_and_modified_files }}"
- name: Confirm files exist
if: ${{ steps.changed-files.outputs.any_changed == 'true' }}
run: |
echo "Checking if files exist..."
for file in ${{ steps.changed-files.outputs.all_changed_and_modified_files }}; do
if [ -f "$file" ]; then
echo "Found: $file"
else
echo "File not found: $file"
exit 1
fi
done
- name: Run vale
if: ${{ steps.changed-files.outputs.any_changed == 'true' }}
uses: errata-ai/vale-action@reviewdog
with:
token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-check
files: ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
separator: ' '
version: '2.27.0'

# - name: Post summary comment
# if: ${{ steps.changed-files.outputs.any_changed == 'true' }}
# run: |
# COMMENT="❗️Oh no, some Vale linting found issues! Please check the **Files change** tab for detailed results and make the necessary updates."
# COMMENT+=$'\n'
# COMMENT+=$'\n\n'
# COMMENT+="➡️ Link to detailed report: [Files changed](${{ github.event.pull_request.html_url }}/files)"
# gh pr comment ${{ github.event.pull_request.number }} --body "$COMMENT"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 10 additions & 0 deletions .hyperlint/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
content_dir: /docs
authorized_users:
- mirnawong1
- matthewshaver
- nghi-ly
- runleonarun
- nataliefiann

vale:
enabled: true
7 changes: 7 additions & 0 deletions .vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
StylesPath = styles
MinAlertLevel = warning

Vocab = EN

[*.md]
BasedOnStyles = custom
53 changes: 49 additions & 4 deletions contributing/adding-page-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ You can use the following components to provide code snippets for each supported

Identify code by labeling with the warehouse names:

```code
```sql
<WHCode>

<div warehouse="warehouse#1">
Expand Down Expand Up @@ -32,7 +32,7 @@ You can use the following components to provide code snippets in a tabbed view.

Identify code and code files by labeling with the component they are describing:

```code
```sql
<Tabs
defaultValue="models"
values={[
Expand Down Expand Up @@ -91,11 +91,11 @@ Identify code and code files by labeling with the component they are describing:

### Link to tabbed content

You can use the [queryString](https://docusaurus.io/docs/next/markdown-features/tabs?current-os=ios#query-string) prop in the `<Tabs>` tag. This allows you to share a link to a page with a pre-selected tab so that clicking on a tab creates a unique hyperlink for that tab. However, this feature doesn't provide an anchor link, which means the browser won't scroll to the tab. Additionally, you can define the search parameter name to use. If the tabs content is under a header, you can alternatively link to the header itself, instaed of the `queryString` prop.
You can use the [queryString](https://docusaurus.io/docs/next/markdown-features/tabs?current-os=ios#query-string) prop in the `<Tabs>` tag. This allows you to share a link to a page with a pre-selected tab so that clicking on a tab creates a unique hyperlink for that tab. However, this feature doesn't provide an anchor link, which means the browser won't scroll to the tab. Additionally, you can define the search parameter name to use. If the tabs content is under a header, you can alternatively link to the header itself, instead of the `queryString` prop.

In the following example, clicking a tab adds a search parameter to the end of the URL: `?current-os=android or ?current-os=ios`.

```
```sql
<Tabs queryString="current-os">
<TabItem value="android" label="Android">
Android
Expand All @@ -105,3 +105,48 @@ In the following example, clicking a tab adds a search parameter to the end of t
</TabItem>
</Tabs>
```

## Markdown Links

Refer to the <a href="https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md#Links" target="_blank" rel="noreferrer">Links section</a> of the Content Style Guide to read about how you can use links in the dbt product documentation.

## Collapsible header

<Collapsible header="The header info">
<div>
<p>Shows and hides children elements</p>
</div>
</Collapsible>

```markdown
<Collapsible header="The header info">
<div>
<p>Shows and hides children elements</p>
</div>
</Collapsible>
</div>
```

## File component

```yml
<File name="~/.dbt/profiles.yml">

```yaml
password: hunter2
```
</File>
```

## LoomVideo component

<pre>{`<LoomVideo id="09919ddb02e44015878c9e93e15fe792" />`}</pre>

<LoomVideo id="09919ddb02e44015878c9e93e15fe792" />

## YoutubeVideo component

<pre>{`<YoutubeVideo id="5yyGT1k2xzY" />`}</pre>

<YoutubeVideo id="5yyGT1k2xzY" />

6 changes: 6 additions & 0 deletions contributing/content-style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,12 @@ When describing icons that appear on-screen, use the [_Google Material Icons_](h

:white_check_mark:Click on the menu icon

#### Upload icons
If you're using icons to document things like [third-party vendors](https://docs.getdbt.com/docs/cloud-integrations/avail-sl-integrations), etc. &mdash; you need to add the icon file in the following locations to ensure the icons render correctly in light and dark mode:

- website/static/img/icons
- website/static/img/icons/white

### Image names

Two words that are either adjectives or nouns describing the name of a file separated by an underscore `_` (known as `snake_case`). The two words can also be separated by a hyphen (`kebab-case`).
Expand Down
Loading

0 comments on commit c98a03a

Please sign in to comment.