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

ci: fix permissions for GITHUB_TOKEN in spell check workflow #22545

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

auricom
Copy link
Contributor

@auricom auricom commented Nov 18, 2024

Description

Try to fix github actions not triggered anymore by automation


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

Summary by CodeRabbit

  • Chores
    • Enhanced spell-checking workflow with new permissions for improved pull request management.
    • Updated the configuration to streamline the process of identifying and fixing spelling errors.

Copy link
Contributor

coderabbitai bot commented Nov 18, 2024

📝 Walkthrough

Walkthrough

The pull request modifies the GitHub Actions workflow for spell checking by adding a permissions section that grants write access to contents and pull-requests. The build job continues to run on ubuntu-latest, executing codespell to identify spelling errors while allowing the process to continue on errors. The step using peter-evans/create-pull-request has been updated to remove the token parameter, maintaining its conditional execution based on the event type.

Changes

File Path Change Summary
.github/workflows/misspell.yml - Added permissions section with contents: write and pull-requests: write.
- Modified uses: peter-evans/create-pull-request@v7 by removing token: ${{ secrets.PRBOT_PAT }}.

Possibly related PRs

Suggested reviewers

  • sontrinh16
  • julienrbrt

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>, 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
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

ACK! We should add *yml to the ignore list it seems.

@auricom
Copy link
Contributor Author

auricom commented Nov 18, 2024

Test was successful : PR has been opened #22546

@auricom auricom changed the title ci(spellcheck): fix permissions for GITHUB_TOKEN ci: fix permissions for GITHUB_TOKEN in spell check workflow Nov 18, 2024
Copy link
Contributor

@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)
.github/workflows/misspell.yml (1)

Line range hint 25-36: Consider adding additional safeguards for automated PR creation.

The workflow automatically creates PRs on a schedule, which is generally fine. However, consider adding:

  1. A limit on the number of concurrent PRs
  2. Branch protection rules for the target branch
  3. Required reviewers for the automated PRs
📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 1b3aeb7 and 4d55822.

📒 Files selected for processing (1)
  • .github/workflows/misspell.yml (1 hunks)
🔇 Additional comments (2)
.github/workflows/misspell.yml (2)

8-11: LGTM! Permissions are correctly configured.

The added permissions block properly defines the minimum required permissions for the workflow to function. This follows security best practices and addresses the automation trigger issues.


Line range hint 21-24: Verify the security implications of continue-on-error.

While the workflow configuration is generally sound, the continue-on-error: true flag could potentially mask important issues. Consider adding error logging or notifications for failed spell checks.

Run this script to check for potential security implications:

@auricom auricom added this pull request to the merge queue Nov 18, 2024
Copy link
Contributor

@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 (2)
.github/workflows/misspell.yml (2)

14-14: Consider pinning the Ubuntu version explicitly.

While ubuntu-latest works, consider using a specific version like ubuntu-22.04 for better reproducibility and to avoid unexpected changes when the latest version is updated.

-    runs-on: ubuntu-latest
+    runs-on: ubuntu-22.04

Line range hint 21-22: Document the file exclusion patterns.

Consider adding a comment explaining why certain files are excluded from spell checking. This helps future maintainers understand the rationale.

       run: |
         sudo apt-get install codespell -y
+        # Skip generated files (*.pb.go, *.cosmos_orm.go), binary files, and external dependencies
         codespell -w --skip="*.pulsar.go,*.pb.go,*.pb.gw.go,*.cosmos_orm.go,*.json,*.git,*.js,crypto/keys,fuzz,*.h,proto/tendermint,*.bin,go.sum,go.mod" --ignore-words=.github/.codespellignore
📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 1b3aeb7 and 4d55822.

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

8-11: LGTM! Permissions are correctly configured.

The added permissions block grants the necessary write access for both repository contents and pull requests, which is required for the spell check workflow to create automated fix PRs. This aligns with GitHub's security best practices.

Copy link
Contributor

@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)
.github/workflows/misspell.yml (1)

Line range hint 1-24: Consider pinning versions for better reproducibility

While the security improvements with permissions are great, consider these enhancements:

  1. Pin the Ubuntu runner to a specific version (e.g., ubuntu-22.04)
  2. Specify the codespell version in the installation command
- runs-on: ubuntu-latest
+ runs-on: ubuntu-22.04

  run: |
-   sudo apt-get install codespell -y
+   sudo apt-get install codespell=2.2.6-1 -y
📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 1b3aeb7 and 4d55822.

📒 Files selected for processing (1)
  • .github/workflows/misspell.yml (1 hunks)
🔇 Additional comments (2)
.github/workflows/misspell.yml (2)

8-11: LGTM! Permissions are correctly configured

The addition of explicit permissions follows GitHub's best practices for Actions security. The permissions are appropriately scoped to only what's needed for the spell check workflow.


Line range hint 1-24: Verify workflow execution

Let's confirm that the workflow is triggering properly with the new permissions.

✅ Verification successful

Workflow is functioning correctly with proper permissions

The verification results show:

  • The last 5 workflow runs completed successfully
  • The workflow file syntax is valid and includes the necessary permissions
  • The workflow is properly configured for both pull requests and scheduled runs
  • The create-pull-request action has the required token configuration
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check recent workflow runs to verify the changes are working

# Check recent workflow runs for this specific workflow
gh run list --workflow "Spell Check" --limit 5 --json status,conclusion,event,createdAt \
  | jq '.[].conclusion'

# Verify the workflow file syntax
gh workflow view "Spell Check" --yaml

Length of output: 1215

Merged via the queue into main with commit 9e36674 Nov 18, 2024
147 of 150 checks passed
@auricom auricom deleted the claude/spellcheck branch November 18, 2024 15:03
alpe added a commit that referenced this pull request Nov 21, 2024
* main:
  build(deps): Bump cosmossdk.io/math from 1.3.0 to 1.4.0 (#22580)
  fix(server/v2/api/telemetry): enable global metrics  (#22571)
  refactor(server/v2/cometbft): add `codec.Codec` and clean-up APIs (#22566)
  feat(core/coretesting): make memDB satisfy db.Db interface (#22570)
  Merge commit from fork
  fix(server(/v2)): fix fallback genesis path (#22564)
  fix: only overwrite context chainID when necessary (#22568)
  docs(client): Update setFeeGranter and setFeePayer comments (#22526)
  fix(baseapp): populate header info in `NewUncachedContext` (#22557)
  build(deps): Bump buf.build/gen/go/cometbft/cometbft/protocolbuffers/go from 1.35.1-20240701160653-fedbb9acfd2f.1 to 1.35.2-20240701160653-fedbb9acfd2f.1 in /api (#22551)
  build(deps): Bump github.com/creachadair/atomicfile from 0.3.5 to 0.3.6 in /tools/confix (#22552)
  docs: Update reference of Approximation (#22550)
  fix(server/v2/comebft): wire missing services + fix simulation (#21964)
  ci: fix permissions for GITHUB_TOKEN on dependabot workflows (#22547)
  ci: fix permissions for GITHUB_TOKEN in spell check workflow (#22545)
  build(deps): Bump google.golang.org/protobuf from 1.35.1 to 1.35.2 (#22537)
  fix(cosmovisor): premature upgrade on restart (#22528)
  fix(store/v2/pebble): handle version 0 in keys (#22524)
  refactor(server/v2/telemetry): swap redirects (#22520)
  docs: Update content in  CODE_OF_CONDUCT.md (#22518)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants