Skip to content
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

7: Fix Algolia search crawler to work properly to re-index content #33

Merged
merged 7 commits into from
Nov 25, 2024

Conversation

mokaymokay
Copy link

@mokaymokay mokaymokay commented Nov 14, 2024

Description

  • Fixes

    • Fixed Github Actions to use correct API key (Admin API Key)
  • Chores

    • Added a step to install Homebrew before running the scraper.
    • Updated checkout action to the latest version for improved performance and security.
  • Documentation

    • Clarified instructions for creating technical references and updating search indices in the README.
    • Specified the need for an Admin API Key for running the Algolia DocSearch scraper.

Type(s) of changes

  • Bug fix
  • New feature
  • Update to an existing feature

Motivation for PR

#7

How Has This Been Tested?

The crawl worked locally and it's working in this build that was triggered with a push event that I added to this branch for testing (since removed)

Applicable screenshots

Screenshot 2024-11-19 at 6 38 37 PM

Follow-up PR

When we merge this to https://github.com/Uniswap/docs, we need to ask the Uniswap developers to update the API Key secret in the Github Actions env to the Algolia Admin API Key.

Copy link

vercel bot commented Nov 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
uniswap-docs-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 21, 2024 2:24pm

Copy link

coderabbitai bot commented Nov 14, 2024

Walkthrough

The changes in the pull request involve updates to the workflow configuration for Algolia Search in the .github/workflows/search.yaml file. The action for checking out the repository has been changed from actions/checkout@v2 to actions/checkout@v4, and a new step to set up Homebrew has been added before the scraper execution. Additionally, the README.md has been updated to clarify the use of the Admin API Key and enhance instructions, while a comment in docusaurus.config.js has been modified for clarity regarding the API key.

Changes

File Change Summary
.github/workflows/search.yaml Updated actions/checkout from v2 to v4; added step to set up Homebrew before running the scraper.
README.md Clarified documentation on creating technical references and search indices; specified use of Admin API Key; enhanced installation and local development instructions.
docusaurus.config.js Updated comment for apiKey in the algolia configuration to clarify it as a "Search-Only API Key (Public & safe to commit)".

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GitHub
    participant Workflow
    participant Scraper
    participant Homebrew

    User->>GitHub: Push to 7-fix-search
    GitHub->>Workflow: Trigger workflow
    Workflow->>Homebrew: Install Homebrew
    Homebrew-->>Workflow: Installation complete
    Workflow->>Scraper: Run scraper
Loading

🐰 "In the garden where code does bloom,
A push to fix, dispelling gloom.
With Homebrew installed, the scraper will play,
Hop along, dear friends, it's a bright new day!
Let's fetch the data, quick and spry,
For in our code, the magic does lie!" 🌼


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3fb3363 and ff7c601.

📒 Files selected for processing (1)
  • .github/workflows/search.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/search.yaml

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

⚡️ Lighthouse Report

Mobile (view report)

Category Score
🟠 Performance 57
🟢 Accessibility 96
🟢 Best practices 92
🟠 SEO 85

Desktop (view report)

Category Score
🟢 Performance 98
🟢 Accessibility 96
🟠 Best practices 83
🟠 SEO 82

Lighthouse ran on https://uniswap-docs-staging-afrnr0quh-uniswap.vercel.app

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9b2b4ea and ae7aa0b.

📒 Files selected for processing (1)
  • .github/workflows/search.yaml (1 hunks)
🧰 Additional context used
🪛 actionlint
.github/workflows/search.yaml

15-15: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (2)
.github/workflows/search.yaml (2)

6-9: Ensure temporary trigger is tracked for removal

The branch-specific trigger is marked as temporary with a TODO comment. To prevent this from being forgotten:

  1. Create a follow-up issue for removing this trigger
  2. Add the issue number to the TODO comment

Would you like me to help create a GitHub issue to track the removal of this temporary trigger?


Line range hint 19-22: Verify Algolia configuration and scraper setup

The workflow depends on:

  1. Valid Algolia credentials in GitHub secrets
  2. Proper configuration in config.json

Let's verify these dependencies exist:

🧰 Tools
🪛 actionlint

15-15: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


19-19: shellcheck reported issue in this script: SC2002:style:2:115: Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead

(shellcheck)

.github/workflows/search.yaml Outdated Show resolved Hide resolved
.github/workflows/search.yaml Outdated Show resolved Hide resolved
Copy link

⚡️ Lighthouse Report

Mobile (view report)

Category Score
🔴 Performance 0
🟢 Accessibility 96
🟢 Best practices 92
🟠 SEO 85

Desktop (view report)

Category Score
🟢 Performance 98
🟢 Accessibility 96
🟠 Best practices 83
🟠 SEO 82

Lighthouse ran on https://uniswap-docs-staging-ovxcw7248-uniswap.vercel.app

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 073e904 and 5436cd6.

📒 Files selected for processing (1)
  • .github/workflows/search.yaml (1 hunks)
🔇 Additional comments (1)
.github/workflows/search.yaml (1)

6-9: Ensure temporary trigger is removed after testing

The TODO comment indicates this push trigger is temporary. Consider:

  1. Adding a follow-up issue to track the removal
  2. Including acceptance criteria for when this can be removed

.github/workflows/search.yaml Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
README.md (1)

122-122: LGTM! Consider additional security enhancements.

Good improvement in clarifying the type of API key required and emphasizing its sensitive nature. To further enhance security, consider adding:

  1. A note about not committing the .env file to version control
  2. Instructions for securely sharing API keys within the team
  3. A template .env.example file with placeholder values

Add these lines after the existing instructions:

 Create an .env file with `APPLICATION_ID` and the `API_KEY` (Admin API Key w/ write access, should be kept secret). 
 If you don't have those, one for the Engineering Managers should be able to help you.
+
+> **Important:** Never commit the `.env` file to version control. Add it to your `.gitignore` file.
+
+For reference, create a `.env.example` file with the following structure:
+```
+APPLICATION_ID=your_app_id_here
+API_KEY=your_admin_api_key_here
+```
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 5436cd6 and 3fb3363.

📒 Files selected for processing (2)
  • README.md (1 hunks)
  • docusaurus.config.js (1 hunks)
🧰 Additional context used
🪛 Gitleaks
docusaurus.config.js

30-30: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

Copy link

⚡️ Lighthouse Report

Mobile (view report)

Category Score
🟠 Performance 79
🟢 Accessibility 96
🟢 Best practices 92
🟠 SEO 85

Desktop (view report)

Category Score
🟢 Performance 98
🟢 Accessibility 96
🟠 Best practices 83
🟠 SEO 82

Lighthouse ran on https://uniswap-docs-staging-a6xgw48ic-uniswap.vercel.app

@mokaymokay mokaymokay changed the title [WIP] 7: Fix search 7: Fix search Nov 21, 2024
@mokaymokay mokaymokay changed the title 7: Fix search 7: Fix search crawler Nov 21, 2024
@mokaymokay mokaymokay changed the title 7: Fix search crawler 7: Fix Algolia search crawler to work properly to re-index Nov 21, 2024
@mokaymokay mokaymokay changed the title 7: Fix Algolia search crawler to work properly to re-index 7: Fix Algolia search crawler to work properly to re-index content Nov 21, 2024
Copy link

⚡️ Lighthouse Report

Mobile (view report)

Category Score
🟠 Performance 85
🟢 Accessibility 96
🟠 Best practices 83
🟠 SEO 85

Desktop (view report)

Category Score
🟢 Performance 98
🟢 Accessibility 96
🟢 Best practices 92
🟠 SEO 82

Lighthouse ran on https://uniswap-docs-staging-6ixvephyp-uniswap.vercel.app

@mokaymokay mokaymokay requested a review from nahbee10 November 25, 2024 13:10
@nahbee10 nahbee10 merged commit 7016877 into main Nov 25, 2024
6 checks passed
Copy link

⚡️ Lighthouse Report

Mobile (view report)

Category Score
🟠 Performance 68
🟢 Accessibility 96
🟢 Best practices 92
🟠 SEO 85

Desktop (view report)

Category Score
🟢 Performance 98
🟢 Accessibility 96
🟢 Best practices 92
🟠 SEO 82

Lighthouse ran on https://uniswap-docs-staging-55pnxqxef-uniswap.vercel.app

@mokaymokay mokaymokay deleted the 7-fix-search branch November 26, 2024 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants