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

[WIP] IEP-1042: Run the installer action with the publishing of release on idf-eclipse-plugin github page #836

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

alirana01
Copy link
Collaborator

@alirana01 alirana01 commented Oct 18, 2023

Description

Run the installer action with the publishing of release on idf-eclipse-plugin github page

Fixes # (IEP-1042)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How has this been tested?

Running and testing the action first by PR and then after merge via a release

Summary by CodeRabbit

  • New Features
    • Automated build process for the IDF (Espressif IoT Development Framework) installer to ensure compatibility with the latest IDE and ESP-IDF releases.

@alirana01 alirana01 added the enhancement New feature or request label Oct 18, 2023
@alirana01 alirana01 self-assigned this Oct 18, 2023
@coderabbitai
Copy link

coderabbitai bot commented Oct 18, 2023

Walkthrough

The GitHub Actions workflow has been updated to automate the build process for the Espressif IoT Development Framework (IDF) installer. It is configured to activate on new releases and pull requests, managing tasks from retrieving IDE versions to fetching the latest esp-idf release, and initiating a subsequent action with defined inputs.

Changes

File Path Change Summary
.github/workflows/.../run_idf_installer_build.yml Automates IDF installer build on new releases and pull requests, fetches latest esp-idf, and triggers receiver action.

Poem

🐇 "In the realm of code and binary,
A workflow springs to life, not ordinary.
With each new tag, it leaps and bounds,
Crafting installers without any sounds." 🚀

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

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>.
    • Generate unit-tests for this file.
  • 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 tests 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 generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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.

Review Status

Actionable comments generated: 1

Commits Files that changed from the base of the PR and between 0267c08 and 81fe82a.
Files selected for processing (1)
  • .github/workflows/run_idf_installer_build.yml (1 hunks)
Additional comments (Suppressed): 1
.github/workflows/run_idf_installer_build.yml (1)
  • 1-21: The GitHub Actions workflow looks well-structured and follows the standard conventions. However, it's important to ensure that the PERSONAL_ACCESS_TOKEN secret is set up correctly in the repository settings. This token is used to authenticate the curl request that triggers the action in the espressif/idf-installer repository. If the token is not set or is incorrect, the action will fail. Also, make sure that the token has the necessary permissions to trigger workflows.

.github/workflows/run_idf_installer_build.yml Outdated 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.

Review Status

Actionable comments generated: 3

Commits Files that changed from the base of the PR and between 81fe82a and e4522a4.
Files selected for processing (1)
  • .github/workflows/run_idf_installer_build.yml (1 hunks)

.github/workflows/run_idf_installer_build.yml Outdated Show resolved Hide resolved
.github/workflows/run_idf_installer_build.yml Outdated 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.

Review Status

Actionable comments generated: 0

Commits Files that changed from the base of the PR and between e4522a4 and 038481f.
Files selected for processing (1)
  • .github/workflows/run_idf_installer_build.yml (1 hunks)
Additional comments (Suppressed): 1
.github/workflows/run_idf_installer_build.yml (1)
  • 1-52: The new GitHub Actions workflow looks well-structured and follows the standard conventions. However, there are a few points to consider:
  1. The use of a personal access token (secrets.PERSONAL_ACCESS_TOKEN) in lines 29, 42. This could potentially expose sensitive information if not handled properly. Make sure that the token has the minimum required permissions and is stored securely as a GitHub secret.

  2. The workflow is triggered on both release events and pull requests (lines 4, 7). Ensure that this is the intended behavior as it could lead to unnecessary runs of the workflow on every pull request.

  3. The IDE version is extracted from the release tag (line 21). This assumes that the tag name always starts with 'v'. If this convention changes in the future, the extraction logic will fail.

  4. The IDF version is fetched from the latest release of the espressif/esp-idf repository (lines 27-36). This assumes that the latest release always contains the desired IDF version. If a specific IDF version is required, this logic may not work as expected.

  5. The Python version is hardcoded as "3.11" in the payload (line 50). If the Python version changes in the future, this will need to be updated manually.

Please verify these points to ensure the workflow functions as expected.

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.

Review Status

Actionable comments generated: 5

Commits Files that changed from the base of the PR and between 038481f and cc4a0a6.
Files selected for processing (1)
  • .github/workflows/run_idf_installer_build.yml (1 hunks)

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.

Review Status

Actionable comments generated: 5

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between cc4a0a6 and 415157f.
Files selected for processing (1)
  • .github/workflows/run_idf_installer_build.yml (1 hunks)

Comment on lines +7 to +8
pull_request:

Copy link

Choose a reason for hiding this comment

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

The pull_request trigger does not specify event types. If the intention is to run the workflow for all pull request events, the colon after pull_request should be removed. If specific event types are desired, they need to be listed.

-  pull_request:
+  pull_request

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
pull_request:
pull_request

Comment on lines +20 to +23
TAG=${{ github.event.release.tag_name }}
IDE_VERSION=${TAG#v}
echo "IDE Version is $IDE_VERSION"
echo "IDE_VERSION=$IDE_VERSION" >> $GITHUB_ENV
Copy link

Choose a reason for hiding this comment

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

The IDE version extraction assumes the tag starts with 'v'. If this is not always the case, the script may fail to extract the correct version. A check should be added to ensure the tag starts with 'v' before stripping it.

Comment on lines +27 to +36
RESPONSE=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.REPO_ACCESS_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/espressif/esp-idf/releases/latest)

TAG_NAME=$(echo "$RESPONSE" | jq -r '.tag_name')
IDF_VERSION=${TAG_NAME#v}
echo "Latest IDF Version is: $IDF_VERSION"
echo "IDF_VERSION=$IDF_VERSION" >> $GITHUB_ENV
Copy link

Choose a reason for hiding this comment

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

Using a personal access token with potentially broad permissions could be a security risk. Ensure that the token used has the minimum required permissions, or consider fetching the release without authentication if possible.

Comment on lines +33 to +36
TAG_NAME=$(echo "$RESPONSE" | jq -r '.tag_name')
IDF_VERSION=${TAG_NAME#v}
echo "Latest IDF Version is: $IDF_VERSION"
echo "IDF_VERSION=$IDF_VERSION" >> $GITHUB_ENV
Copy link

Choose a reason for hiding this comment

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

The script assumes that the IDF version tag will always start with 'v'. If this is not always the case, the script may fail to extract the correct version. A check should be added to ensure the tag starts with 'v' before stripping it.

Comment on lines +41 to +52
curl -X POST \
-H "Authorization: Bearer ${{ secrets.REPO_ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/espressif/idf-installer/actions/workflows/build-espressif-ide-installer.yml/dispatches \
-d '{
"ref": "main",
"inputs": {
"espressif_ide_version": "'$IDE_VERSION'",
"esp_idf_version": "'$IDF_VERSION'",
"python_version": "3.11"
}
}'
Copy link

Choose a reason for hiding this comment

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

The script uses a personal access token to trigger the Receiver Action. Ensure that the token used has the minimum required permissions to mitigate security risks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant