-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat: Introduce GitHub Actions workflow for automated Playwright E2E documentation updates. #25545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| # 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: | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| update-docs: | ||
| runs-on: ubuntu-latest | ||
| 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 | ||
ShaileshParmar11 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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 | ||
|
|
||
ShaileshParmar11 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - 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 | ||
ShaileshParmar11 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| 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 | ||
| } | ||
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.