✅ | ` |
docs-remove-message
->
master`
#748
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Process Docs Changes | |
on: | |
workflow_dispatch: | |
inputs: | |
source_branch: | |
description: metabase/metabase branch triggered this workflow | |
required: true | |
type: string | |
target_branch: | |
description: metabase/metabase target branch name | |
required: true | |
type: string | |
annotation: | |
description: note to describe what the pr does | |
required: false | |
type: string | |
default: "auto-build" | |
dispatch_type: | |
description: 'Type of dispatch action to simulate' | |
required: false | |
default: 'docs_update' | |
type: choice | |
options: | |
- docs_update | |
- docs_merge | |
repository_dispatch: | |
types: [docs_update, docs_merge] | |
run-name: >- | |
${{ | |
(github.event.action == 'docs_merge' || github.event.inputs.dispatch_type == 'docs_merge') && '✅' || | |
(github.event.action == 'docs_update' || github.event.inputs.dispatch_type == 'docs_update') && '🔄' | |
}} | `${{ github.event.inputs.annotation || github.event.client_payload.annotation }}` | `${{ github.event.inputs.source_branch || github.event.client_payload.source_branch }}` | |
-> `${{ github.event.inputs.target_branch || github.event.client_payload.target_branch }}` | |
jobs: | |
build: | |
name: >- | |
`${{ github.event.inputs.source_branch || github.event.client_payload.source_branch }}` -> ${{ github.event.inputs.target_branch || github.event.client_payload.target_branch }} | ${{ github.event.action || github.event.inputs.dispatch_type }} | |
runs-on: ubuntu-latest | |
env: | |
MAIN_REPO_SOURCE_BRANCH: "${{ github.event.inputs.source_branch || github.event.client_payload.source_branch }}" | |
MAIN_REPO_TARGET_BRANCH: "${{ github.event.inputs.target_branch || github.event.client_payload.target_branch }}" | |
ANNOTATION: "${{ github.event.inputs.annotation || github.event.client_payload.annotation || 'auto-build' }}" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set current branch name | |
run: echo "LOCAL_REPO_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_ENV" | |
- name: echo branch names | |
run: | | |
echo "metabase/metabase source_branch: $MAIN_REPO_SOURCE_BRANCH" | |
echo "metabase/metabase target_branch: $MAIN_REPO_TARGET_BRANCH" | |
echo "Running on (docs.metabase.github.io) branch: $LOCAL_REPO_BRANCH" | |
- name: Prepare java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' # See 'Supported distributions' for available options | |
java-version: '21' | |
- name: Install Clojure (needed to build cljs for SDK dox generation) | |
uses: DeLaGuardo/[email protected] | |
with: | |
cli: 1.12.0.1530 | |
bb: 1.12.200 | |
- name: Run docs repo build tests | |
run: | | |
bb script/_test/all.clj | |
- name: Filter non-documented branches | |
run: | | |
bb script/check_incoming_branchname.clj --target-branch "$MAIN_REPO_TARGET_BRANCH" | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
- name: Install js dependencies | |
run: yarn install --frozen-lockfile --prefer-offline | |
- name: Set up Ruby # uses version from .ruby-version | |
uses: ruby/setup-ruby@d5fb7a202fc07872cb44f00ba8e6197b70cb0c55 # v1.179.0 | |
with: | |
bundler-cache: true | |
- name: Install ruby dependencies | |
run: | | |
bundle install | |
- name: Setup Git Authenticatation | |
run: | | |
git config --global user.name "Metabase Docs bot" | |
git config --global user.email "[email protected]" | |
git remote set-url origin "https://x-access-token:${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}@github.com/metabase/docs.metabase.github.io.git" | |
- name: Announce env vars | |
run: | | |
echo "main_repo_source_branch = '${{ env.MAIN_REPO_SOURCE_BRANCH }}'" | |
echo "main_repo_target_branch = '${{ env.MAIN_REPO_TARGET_BRANCH }}'" | |
- name: Update docs for branchname | |
# for docs_merge, the tarball will be gone by the time this workflow runs. | |
if: | | |
(github.event_name == 'repository_dispatch' && github.event.action == 'docs_update') || | |
(github.event_name == 'workflow_dispatch' && github.event.inputs.dispatch_type == 'docs_update') | |
run: | | |
bb script/update_docs_for_branchname.clj --source-branch "$MAIN_REPO_SOURCE_BRANCH" --target-branch "$MAIN_REPO_TARGET_BRANCH" | |
- name: Cleanup cloud docs (move them to latest, remove from all other versions) | |
run: | | |
bb script/cleanup_cloud_docs.clj | |
- name: Checkout Control files from Marketing Repo | |
uses: actions/checkout@v4 | |
with: | |
repository: metabase/metabase.github.io | |
ref: master | |
path: .marketing_repo | |
token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }} | |
- name: Merge control files from Marketing Repo | |
run: | | |
bb script/sync_repo.clj --from-repo .marketing_repo | |
- name: "yarn lint-markdown" | |
run: | | |
yarn lint-markdown | |
- name: "yarn lint-styles" | |
run: | | |
yarn lint-styles | |
- name: "yarn lint-scripts" | |
run: | | |
yarn lint-scripts | |
- name: "yarn lint-links" | |
run: | | |
yarn lint-links | |
- name: Build the Jekyll Site | |
env: | |
JEKYLL_ENV: production | |
NODE_ENV: production | |
run: | | |
# Clear the existing site: | |
rm -rf _site | |
# Build the jekyll site: | |
script/build | |
- name: Run htmlproofer + metabase.com-aware link checks | |
run: | | |
SECONDS=0 | |
script/links || true | |
echo "Time elapsed: ${SECONDS} seconds" | |
echo 'checking reported links...' | |
echo "htmlproofer spit out a report of length: $(wc -l < htmlproofer.out)" | |
bb script/analyze_links.clj --htmlproofer-output htmlproofer.out --limit 1 | |
- name: Update or Create the Pull Request | |
if: | | |
(github.event_name == 'repository_dispatch' && github.event.action == 'docs_update') || | |
(github.event_name == 'workflow_dispatch' && github.event.inputs.dispatch_type == 'docs_update') | |
env: | |
GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }} | |
run: | | |
bb script/update_or_create_pr.clj --source-branch "$MAIN_REPO_SOURCE_BRANCH" --target-branch "$MAIN_REPO_TARGET_BRANCH" --annotation "$ANNOTATION" | |
- name: Remove control files from Marketing Repo | |
run: | | |
bb script/sync_repo.clj --delete | |
- name: Merge Updated Docs | |
if: | | |
(github.event_name == 'repository_dispatch' && github.event.action == 'docs_merge') || | |
(github.event_name == 'workflow_dispatch' && github.event.inputs.dispatch_type == 'docs_merge') | |
env: | |
GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }} | |
MAIN_REPO_SOURCE_BRANCH: ${{ github.event.inputs.source_branch || github.event.client_payload.source_branch }} | |
run: | | |
bb script/merge.clj --source-branch "$MAIN_REPO_SOURCE_BRANCH" --target-branch "$MAIN_REPO_TARGET_BRANCH" |