OpenMetadata/.github/workflows/update-playwright-e2e-docs.yml
Shailesh Parmar 0422260729
feat: Introduce GitHub Actions workflow for automated Playwright E2E documentation updates. (#25545)
* feat: Introduce GitHub Actions workflow for automated Playwright E2E documentation updates and update README.

* feat: refine Playwright E2E docs workflow and documentation

* addressing review comment
2026-01-27 18:46:07 +05:30

94 lines
3.3 KiB
YAML

# Copyright 2021 Collate
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Update Playwright E2E Documentation
on:
workflow_dispatch:
jobs:
update-docs:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Validate Branch
run: |
if [ "${{ github.ref }}" != "refs/heads/main" ]; then
echo "This workflow can only be run on the main branch."
exit 1
fi
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: "openmetadata-ui/src/main/resources/ui/.nvmrc"
cache: "yarn"
cache-dependency-path: openmetadata-ui/src/main/resources/ui/yarn.lock
- name: Install Yarn
run: npm install -g yarn
- name: Install Dependencies
working-directory: openmetadata-ui/src/main/resources/ui
run: yarn install --frozen-lockfile --ignore-scripts
- name: Install Playwright Browsers
working-directory: openmetadata-ui/src/main/resources/ui
run: npx playwright install --with-deps
- name: Generate E2E Docs
working-directory: openmetadata-ui/src/main/resources/ui
run: yarn generate:e2e-docs
- name: Detect Changes
id: git-check
run: |
if [ -z "$(git status --porcelain openmetadata-ui/src/main/resources/ui/playwright/docs)" ]; then
echo "No changes detected."
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "Changes detected."
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
if: steps.git-check.outputs.changed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH_NAME="chore/update-playwright-docs"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -B $BRANCH_NAME
git add openmetadata-ui/src/main/resources/ui/playwright/docs
git commit -m "chore: update Playwright E2E documentation"
git push origin $BRANCH_NAME --force
gh pr create \
--title "chore: update Playwright E2E documentation" \
--body "This is an automated PR to update the Playwright E2E documentation. Generated by the \`Update Playwright E2E Documentation\` workflow." \
--base main \
--head $BRANCH_NAME || {
if gh pr list --head $BRANCH_NAME --state open --json number -jq '.[0].number' | grep -q .; then
echo "PR already exists"
else
echo "Failed to create PR"
exit 1
fi
}