OpenMetadata/.github/workflows/update-playwright-e2e-docs.yml
Chirag Madlani 917a36c6a4
Potential fix for code scanning alert no. 1842: Artifact poisoning (#27220)
* Potential fix for code scanning alert no. 1842: Artifact poisoning

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Pin Yarn version to 1.22.18 to fix artifact poisoning alert

Agent-Logs-Url: https://github.com/open-metadata/OpenMetadata/sessions/29aebdb5-eef0-4a2a-be01-489deef48d2b

Co-authored-by: chirag-madlani <12962843+chirag-madlani@users.noreply.github.com>

* Fix artifact poisoning in update-playwright-e2e-docs.yml: replace npm install -g yarn with pinned corepack

Agent-Logs-Url: https://github.com/open-metadata/OpenMetadata/sessions/550fba5a-bb13-45da-a144-b67599c9eaa4

Co-authored-by: chirag-madlani <12962843+chirag-madlani@users.noreply.github.com>

* Remove corepack prepare to eliminate artifact poisoning: use only corepack enable (bundled yarn)

Agent-Logs-Url: https://github.com/open-metadata/OpenMetadata/sessions/90f6ed8d-3f2b-4c3d-9a34-cd1f57c4d89c

Co-authored-by: chirag-madlani <12962843+chirag-madlani@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-04-10 16:12:28 +05:30

93 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: corepack enable
- 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 chromium --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
}