Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 2k
feat: Add auto-classification support for storage service containers #6690
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: TypeScript Type Generation | |
| on: | |
| merge_group: | |
| pull_request_target: | |
| types: [opened, synchronize, reopened, labeled, ready_for_review] | |
| paths: | |
| - 'openmetadata-spec/src/main/resources/json/schema/**' | |
| - 'openmetadata-ui/src/main/resources/ui/src/generated/**' | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| description: 'Branch to run the workflow on (ignored if pr_number is provided)' | |
| required: false | |
| default: 'main' | |
| type: string | |
| pr_number: | |
| description: 'PR number to run the workflow for (works for both forked and non-forked PRs)' | |
| required: false | |
| type: string | |
| concurrency: | |
| group: typescript-generation-${{ github.event.pull_request.number || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| generate-types: | |
| runs-on: ubuntu-latest | |
| if: ${{ !github.event.pull_request.draft }} | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Get PR details for workflow_dispatch | |
| if: github.event_name == 'workflow_dispatch' && github.event.inputs.pr_number != '' | |
| id: pr-details | |
| env: | |
| PR_NUMBER: ${{ github.event.inputs.pr_number }} | |
| BASE_REPO: ${{ github.repository }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| PR_DATA=$(gh pr view "$PR_NUMBER" --json headRepository,headRefName,headRepositoryOwner,headRefOid --repo "$BASE_REPO") | |
| echo "head_repo=$(echo "$PR_DATA" | jq -r '.headRepository.name')" >> $GITHUB_OUTPUT | |
| echo "head_owner=$(echo "$PR_DATA" | jq -r '.headRepositoryOwner.login')" >> $GITHUB_OUTPUT | |
| echo "head_ref=$(echo "$PR_DATA" | jq -r '.headRefName')" >> $GITHUB_OUTPUT | |
| echo "head_sha=$(echo "$PR_DATA" | jq -r '.headRefOid')" >> $GITHUB_OUTPUT | |
| echo "full_repo=$(echo "$PR_DATA" | jq -r '.headRepositoryOwner.login + "/" + .headRepository.name')" >> $GITHUB_OUTPUT | |
| - name: Wait for the labeler | |
| uses: lewagon/wait-on-check-action@v1.3.4 | |
| if: ${{ github.event_name == 'pull_request_target' && github.actor != 'github-actions[bot]' }} | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| check-name: Team Label | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| wait-interval: 90 | |
| - name: Verify PR labels | |
| uses: jesusvasquez333/verify-pr-label-action@v1.4.0 | |
| if: ${{ github.event_name == 'pull_request_target' && github.actor != 'github-actions[bot]' }} | |
| with: | |
| github-token: '${{ secrets.GITHUB_TOKEN }}' | |
| valid-labels: 'safe to test' | |
| pull-request-number: '${{ github.event.pull_request.number }}' | |
| disable-reviews: true | |
| - name: Check if repository is a fork | |
| id: check-fork | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| FULL_REPO: ${{ steps.pr-details.outputs.full_repo }} | |
| HEAD_REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name }} | |
| BASE_REPO: ${{ github.repository }} | |
| run: | | |
| if [ "$EVENT_NAME" == "workflow_dispatch" ] && [ -n "$FULL_REPO" ]; then | |
| # For workflow_dispatch with PR number | |
| if [ "$FULL_REPO" != "$BASE_REPO" ]; then | |
| echo "is_fork=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "is_fork=false" >> $GITHUB_OUTPUT | |
| fi | |
| elif [ "$EVENT_NAME" == "pull_request_target" ]; then | |
| # For pull_request_target events | |
| if [ "$HEAD_REPO_FULL_NAME" != "$BASE_REPO" ]; then | |
| echo "is_fork=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "is_fork=false" >> $GITHUB_OUTPUT | |
| fi | |
| else | |
| # Default to non-fork for direct branch runs | |
| echo "is_fork=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Determine checkout ref | |
| id: checkout-ref | |
| env: | |
| IS_FORK: ${{ steps.check-fork.outputs.is_fork }} | |
| EVENT_NAME: ${{ github.event_name }} | |
| PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} | |
| PR_DETAILS_HEAD_SHA: ${{ steps.pr-details.outputs.head_sha }} | |
| PR_DETAILS_HEAD_REF: ${{ steps.pr-details.outputs.head_ref }} | |
| INPUT_BRANCH: ${{ github.event.inputs.branch }} | |
| GITHUB_REF: ${{ github.ref }} | |
| GITHUB_SHA_VAL: ${{ github.sha }} | |
| run: | | |
| if [ "$EVENT_NAME" == "merge_group" ]; then | |
| echo "ref=$GITHUB_SHA_VAL" >> $GITHUB_OUTPUT | |
| elif [ "$IS_FORK" == "true" ] && [ "$EVENT_NAME" == "pull_request_target" ]; then | |
| echo "ref=$PR_HEAD_SHA" >> $GITHUB_OUTPUT | |
| elif [ "$EVENT_NAME" == "pull_request_target" ]; then | |
| echo "ref=$PR_HEAD_REF" >> $GITHUB_OUTPUT | |
| elif [ "$IS_FORK" == "true" ] && [ -n "$PR_DETAILS_HEAD_SHA" ]; then | |
| echo "ref=$PR_DETAILS_HEAD_SHA" >> $GITHUB_OUTPUT | |
| elif [ -n "$PR_DETAILS_HEAD_REF" ]; then | |
| echo "ref=$PR_DETAILS_HEAD_REF" >> $GITHUB_OUTPUT | |
| elif [ -n "$INPUT_BRANCH" ]; then | |
| echo "ref=$INPUT_BRANCH" >> $GITHUB_OUTPUT | |
| else | |
| echo "ref=$GITHUB_REF" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ steps.pr-details.outputs.full_repo || github.repository }} | |
| ref: ${{ steps.checkout-ref.outputs.ref }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: 'openmetadata-ui/src/main/resources/ui/.nvmrc' | |
| - name: Install dependencies | |
| run: | | |
| yarn install --frozen-lockfile | |
| - name: Generate TypeScript types | |
| run: | | |
| cd openmetadata-ui/src/main/resources/ui | |
| # Create a symlink to the root node_modules | |
| ln -sf ../../../../../node_modules . | |
| ./json2ts-generate-all.sh -l true | |
| - name: Check for changes | |
| id: git-check | |
| continue-on-error: true | |
| run: | | |
| git add openmetadata-ui/src/main/resources/ui/src/generated/ | |
| git diff --cached --quiet | |
| - name: Configure Git | |
| if: steps.git-check.outcome != 'success' | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| - name: Commit and push changes | |
| if: steps.git-check.outcome != 'success' && steps.check-fork.outputs.is_fork == 'false' | |
| run: | | |
| git commit -m "Update generated TypeScript types" | |
| git push --force-with-lease | |
| - name: Create PR comment about auto-update | |
| if: steps.git-check.outcome != 'success' && steps.check-fork.outputs.is_fork == 'false' && (github.event_name == 'pull_request_target' || github.event.inputs.pr_number != '') | |
| uses: peter-evans/create-or-update-comment@v4 | |
| with: | |
| issue-number: ${{ github.event.pull_request.number || github.event.inputs.pr_number }} | |
| body: | | |
| ## ✅ TypeScript Types Auto-Updated | |
| The generated TypeScript types have been automatically updated based on JSON schema changes in this PR. | |
| - name: Create PR comment for fork repository | |
| if: steps.git-check.outcome != 'success' && steps.check-fork.outputs.is_fork == 'true' && (github.event_name == 'pull_request_target' || github.event.inputs.pr_number != '') | |
| uses: peter-evans/create-or-update-comment@v4 | |
| with: | |
| issue-number: ${{ github.event.pull_request.number || github.event.inputs.pr_number }} | |
| body: | | |
| ## ⚠️ TypeScript Types Need Update | |
| **The generated TypeScript types are out of sync with the JSON schema changes.** | |
| Since this is a pull request from a forked repository, the types cannot be automatically committed. | |
| Please generate and commit the types manually: | |
| ```bash | |
| cd openmetadata-ui/src/main/resources/ui | |
| ./json2ts-generate-all.sh -l true | |
| git add src/generated/ | |
| git commit -m "Update generated TypeScript types" | |
| git push | |
| ``` | |
| After pushing the changes, this check will pass automatically. | |
| - name: Fail workflow for fork PRs with type changes | |
| if: steps.git-check.outcome != 'success' && steps.check-fork.outputs.is_fork == 'true' | |
| run: exit 1 |
You can’t perform that action at this time.
