Repository navigation
fix: reload examples page only when the session has expired #308
Workflow file for this run
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: Code Review | |
| # Reviews a pull request with the shared vaadin/github-actions/code-review | |
| # action and posts the findings as one review by vaadin-review-bot. Runs when a | |
| # pull request to main is opened or marked ready for review, and on request: a | |
| # "/code-review" comment on a pull request to any branch, or a review request | |
| # for vaadin-review-bot. | |
| # This workflow owns the triggers, the eligibility rules, the choice of review | |
| # profile and the reaction to the trigger. | |
| on: | |
| issue_comment: | |
| types: [created] | |
| pull_request: | |
| types: [opened, ready_for_review, review_requested] | |
| env: | |
| PR_NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }} | |
| jobs: | |
| check: | |
| # A cheap `if` pre-filter, then an authoritative permission check in the | |
| # job: only users with write access start a review. A requested review (a | |
| # comment or a review request) checks only who asked. An automatic trigger | |
| # runs only for pull requests to main, and skips drafts, Dependabot, | |
| # cherry-picks, version updates and chore pull requests. A pull request | |
| # opened with vaadin-review-bot as a reviewer is reviewed once, by its | |
| # review_requested event. Doc Bot and totally-not-ai open drafts, so their | |
| # pull requests are reviewed when a person marks them ready for review. | |
| # A pull_request event runs the workflow of the pull request's base | |
| # branch, so a review request works only where that branch has this | |
| # file. A "/code-review" comment always runs the workflow of main. | |
| # Pull requests from forks are not reviewed: the pre-filter skips their | |
| # pull request events, and the job skips a "/code-review" comment on one. | |
| if: | | |
| (github.event_name == 'issue_comment' && | |
| github.event.issue.pull_request && | |
| github.event.comment.body == '/code-review' && | |
| contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)) || | |
| (github.event_name == 'pull_request' && | |
| !github.event.pull_request.head.repo.fork && | |
| github.event.action == 'review_requested' && | |
| github.event.requested_reviewer.login == 'vaadin-review-bot') || | |
| (github.event_name == 'pull_request' && | |
| !github.event.pull_request.head.repo.fork && | |
| contains(fromJSON('["opened", "ready_for_review"]'), github.event.action) && | |
| github.event.pull_request.base.ref == 'main' && | |
| github.event.pull_request.draft == false && | |
| !(github.event.action == 'opened' && | |
| contains(github.event.pull_request.requested_reviewers.*.login, 'vaadin-review-bot')) && | |
| github.event.pull_request.user.login != 'dependabot[bot]' && | |
| !contains(github.event.pull_request.title, '(CP: ') && | |
| !startsWith(github.event.pull_request.title, 'Update vaadin version') && | |
| !startsWith(github.event.pull_request.title, 'chore:') && | |
| !startsWith(github.event.pull_request.title, 'chore(')) | |
| runs-on: ubuntu-26.04 | |
| timeout-minutes: 5 | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| outputs: | |
| eligible: ${{ steps.access.outputs.eligible }} | |
| profile: ${{ steps.profile.outputs.profile }} | |
| steps: | |
| - name: Check repository permission and pull request origin | |
| id: access | |
| env: | |
| GH_TOKEN: ${{ secrets.VAADIN_REVIEW_BOT || github.token }} | |
| REQUESTER: ${{ github.event.sender.login }} | |
| run: | | |
| # .permission rather than .role_name: maintain and custom roles | |
| # based on write or maintain are reported as "write" there | |
| role=$(gh api "repos/${{ github.repository }}/collaborators/$REQUESTER/permission" \ | |
| --jq .permission || echo none) | |
| # A comment event does not say where the pull request comes from | |
| cross=$(gh pr view "$PR_NUMBER" --repo "${{ github.repository }}" \ | |
| --json isCrossRepository --jq .isCrossRepository || echo true) | |
| if [ "$cross" != false ]; then | |
| echo "Skipping a pull request from a fork." | |
| echo "eligible=false" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| case "$role" in | |
| admin|write) echo "eligible=true" >> "$GITHUB_OUTPUT" ;; | |
| *) echo "eligible=false" >> "$GITHUB_OUTPUT" ;; | |
| esac | |
| - name: Select review profile | |
| id: profile | |
| if: steps.access.outputs.eligible == 'true' | |
| env: | |
| GH_TOKEN: ${{ secrets.VAADIN_REVIEW_BOT || github.token }} | |
| run: | | |
| # Pages and their code examples get the docs profile. A pull request | |
| # that changes only tooling, such as scripts, workflows or the | |
| # publisher theme, gets the code profile. | |
| files=$(gh api --paginate "repos/${{ github.repository }}/pulls/$PR_NUMBER/files" \ | |
| --jq '.[].filename') | |
| if grep -qE '^(articles|src|frontend)/' <<< "$files"; then | |
| echo "profile=docs" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "profile=code" >> "$GITHUB_OUTPUT" | |
| fi | |
| review: | |
| needs: check | |
| if: needs.check.outputs.eligible == 'true' | |
| # One review per pull request at a time. A new trigger queues instead of | |
| # cancelling a run that may be posting. The group is on the job, not on the | |
| # workflow, so that a trigger that fails the pre-filter cannot cancel an | |
| # eligible run that waits for its turn. | |
| concurrency: | |
| group: code-review-${{ github.event.issue.number || github.event.pull_request.number }} | |
| cancel-in-progress: false | |
| runs-on: ubuntu-26.04 | |
| timeout-minutes: 45 | |
| permissions: | |
| contents: read | |
| issues: write | |
| pull-requests: write | |
| steps: | |
| - name: React to trigger | |
| env: | |
| GH_TOKEN: ${{ secrets.VAADIN_REVIEW_BOT || github.token }} | |
| run: | | |
| if [ "${{ github.event_name }}" = "issue_comment" ]; then | |
| target="issues/comments/${{ github.event.comment.id }}" | |
| else | |
| target="issues/$PR_NUMBER" | |
| fi | |
| gh api "repos/${{ github.repository }}/$target/reactions" \ | |
| -f content=eyes | |
| # The review session is read-only and never builds or runs anything, so | |
| # it needs Node only, for the action's scripts and the Claude Code CLI. | |
| - name: Checkout PR branch | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: refs/pull/${{ env.PR_NUMBER }}/head | |
| fetch-depth: 1 | |
| # The review action authenticates with its `github-token` input. | |
| persist-credentials: false | |
| - name: Set up Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22' | |
| # The review uses no MCP servers. The repository's .mcp.json is for local | |
| # authoring sessions. | |
| - name: Remove the MCP configuration | |
| run: rm -f .mcp.json | |
| - name: Run code review | |
| uses: vaadin/github-actions/code-review@2c9bd830f448599af76fa9a124360189f4613542 # main | |
| with: | |
| anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }} | |
| pr-number: ${{ env.PR_NUMBER }} | |
| profile: ${{ needs.check.outputs.profile }} | |
| github-token: ${{ secrets.VAADIN_REVIEW_BOT || github.token }} | |
| reference-repos: | | |
| vaadin/flow | the Vaadin Flow framework (Java): routing, server-side UI, data binding, signals, security, dev mode and the build tooling. The source of the pages under articles/flow and most pages under articles/building-apps. | |
| vaadin/flow-components | the Java API of the Vaadin UI components. The source of the Java examples and the Java API on the pages under articles/components. | |
| vaadin/web-components | the Vaadin web components (TypeScript): behavior, properties, events, styling parts and theme variants. The source of the component behavior, the styling pages, and the Lit and React examples under articles/components. | |
| vaadin/hilla | the Hilla framework (Java and TypeScript): browser-callable services and React views. The source of the pages about them under articles/flow, such as articles/flow/react-views, and under articles/building-apps/react. | |
| vaadin/browserless-test | the browserless test framework for Flow. The source of the pages under articles/flow/testing/browserless and articles/building-apps/testing/browserless. | |
| extra-instructions: | | |
| # Documentation Review Context | |
| This repository holds the pages of vaadin.com/docs and the code examples that they include. `guidelines/repository.md` describes the layout, how files map to URLs, and the branches. | |
| These checks of a pull request already report their findings: | |
| - Vale (`lint`): the writing style of the lines added under `articles/`. | |
| - Maven Compile and Format Check: the Java examples compile and follow the Java formatting conventions. | |
| - Check Redirects: a moved or removed page leaves a redirect behind, and every redirect resolves. | |
| - Check Versions: the version attributes in `articles/_vaadin-version.adoc` match `pom.xml`. | |
| - Check Feature Flags: every feature flag of Flow and Flow Components is documented. | |
| No check compiles or lints the TypeScript examples under `frontend/`. | |
| The pages use the AsciiDoc extensions of Vaadin Design System Publisher. Rendered examples, `// hidden-source-line` comments and `since` badges are valid markup. `articles/contributing/docs/dspublisher/editing.adoc` documents them. | |
| Several commercial products have no source in the reference checkouts. Their pages fall under the rule for unverifiable claims. | |
| upload-execution-log: ${{ vars.CLAUDE_DEBUG }} |