-
Notifications
You must be signed in to change notification settings - Fork 98
feat(ci): add pre-commit checks #7280
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
Conversation
📝 WalkthroughWalkthroughA new reusable GitHub Actions workflow for pre-commit checks is introduced, and the main workflow is updated to use it as a job. The new workflow enforces concurrency, secures the runner, sets up Nix and Cachix, and runs pre-commit checks in a reproducible environment. Changes
Sequence Diagram(s)sequenceDiagram
participant GitHub Actions
participant checks.yaml
participant checks-pre-commit.yaml
participant Self-hosted Runner
GitHub Actions->>checks.yaml: Trigger workflow (PR or merge group)
checks.yaml->>checks-pre-commit.yaml: Call reusable pre-commit workflow\n(pass repo/branch)
checks-pre-commit.yaml->>Self-hosted Runner: Start job (pre-commit)
Self-hosted Runner->>Self-hosted Runner: Harden environment
Self-hosted Runner->>Self-hosted Runner: Checkout repo/branch
Self-hosted Runner->>Self-hosted Runner: Install Nix & configure Cachix
Self-hosted Runner->>Self-hosted Runner: Run pre-commit checks
Suggested labels
Suggested reviewers
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a dedicated pre-commit CI workflow and integrates it into the existing checks pipeline to enforce pre-commit checks before merging.
- Introduces
.github/workflows/checks-pre-commit.yaml
with runner hardening, Nix/Cachix setup, and apre-commit
step. - Updates
.github/workflows/checks.yaml
to call the new pre-commit workflow as a job.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
.github/workflows/checks-pre-commit.yaml | New workflow triggered on merge_group to run hardened pre-commit checks using Nix/Cachix. |
.github/workflows/checks.yaml | Added pre-commit job via workflow_call to include the new workflow in main CI checks. |
Comments suppressed due to low confidence (2)
.github/workflows/checks-pre-commit.yaml:16
- The concurrency group suffix '-audit' appears to be copied from the audit workflow; consider renaming it to '-pre-commit' to avoid conflicts and clarify its purpose.
group: ${{ inputs.source_branch || github.ref_name }}-audit
.github/workflows/checks-pre-commit.yaml:20
- The job ID 'cargo-audit' doesn't match this workflow's function; renaming it to 'pre-commit' or 'pre-commit-checks' would improve clarity.
cargo-audit:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Nitpick comments (1)
.github/workflows/checks-pre-commit.yaml (1)
22-22
: Unknown self-hosted runner label will keep actionlint red
Add the label to.github/actionlint.yaml
’srunner-labels
allow-list (or disable the rule) so CI lint stays green.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/checks-pre-commit.yaml
(1 hunks).github/workflows/checks.yaml
(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: tolbrino
PR: hoprnet/hoprnet#6502
File: flake.nix:12-14
Timestamp: 2024-09-30T08:27:16.849Z
Learning: The project already has CI workflows that automatically check for compatibility issues when updating dependencies, including compiling smart contracts with new Solidity versions, running the test suite, checking for compiler warnings or deprecation notices, and reviewing changelogs for breaking changes.
Learnt from: tolbrino
PR: hoprnet/hoprnet#6502
File: flake.nix:12-14
Timestamp: 2024-10-09T06:16:18.170Z
Learning: The project already has CI workflows that automatically check for compatibility issues when updating dependencies, including compiling smart contracts with new Solidity versions, running the test suite, checking for compiler warnings or deprecation notices, and reviewing changelogs for breaking changes.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7191
File: .github/workflows/open-pr.yaml:34-43
Timestamp: 2025-06-30T08:33:20.974Z
Learning: In the hoprnet repository, the maintainer ausias-armesto prefers to add commit types to the semantic PR validation workflow incrementally as needed, rather than preemptively adding all possible types. This conservative approach keeps the workflow configuration lean.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6366
File: ethereum/contracts/contracts-addresses.json:0-0
Timestamp: 2024-07-11T10:39:11.293Z
Learning: The user has asked to add a Git pre-commit hook to the PR to prevent changes to the `contracts-addresses.json` file.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6366
File: ethereum/contracts/contracts-addresses.json:0-0
Timestamp: 2024-10-09T06:16:18.170Z
Learning: The user has asked to add a Git pre-commit hook to the PR to prevent changes to the `contracts-addresses.json` file.
Learnt from: mjadach-iv
PR: hoprnet/hoprnet#6663
File: deploy/compose/.env.sample:57-57
Timestamp: 2024-11-21T13:58:22.345Z
Learning: In code reviews for this project, focus comments on the changes made in the PR, and avoid discussing unrelated code.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: .github/workflows/package.yaml:28-28
Timestamp: 2025-06-19T10:07:29.649Z
Learning: In GitHub Actions reusable workflows, the github.event_name context may inherit from the parent workflow rather than being set to 'workflow_call', allowing conditions like 'github.event_name == 'pull_request'' to work correctly when the parent workflow was triggered by a pull_request event.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6886
File: nix/rust-package.nix:84-84
Timestamp: 2025-02-25T00:35:33.437Z
Learning: When transitioning from vendored dependencies to a private proxy registry in Rust projects, GitHub Actions workflows need to be refactored to accommodate the new update strategy, particularly workflows handling dependency updates like renovate-cargo-update.yaml.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7191
File: .github/workflows/open-pr.yaml:83-95
Timestamp: 2025-06-30T08:36:01.702Z
Learning: The self-hosted-hoprnet-small runners in the hoprnet repository have GitHub CLI (gh) pre-installed and available for use in workflows.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: .github/workflows/package.yaml:28-28
Timestamp: 2025-06-19T10:07:29.649Z
Learning: In GitHub Actions reusable workflows, the github context from the caller workflow is inherited by the called workflow, so github.event_name reflects the original triggering event (e.g., 'pull_request') rather than being set to 'workflow_call'. Conditions like 'github.event_name == 'pull_request'' work correctly in reusable workflows when the parent workflow was triggered by that event type.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: .github/workflows/package.yaml:28-28
Timestamp: 2025-06-19T10:08:43.091Z
Learning: In GitHub Actions reusable workflows, the github context from the caller workflow is inherited by the called workflow, so github.event_name reflects the original triggering event (e.g., 'pull_request') rather than being set to 'workflow_call'. Conditions like 'github.event_name == 'pull_request'' work correctly in reusable workflows when the parent workflow was triggered by that event type.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: .github/workflows/package.yaml:28-28
Timestamp: 2025-06-19T10:08:43.091Z
Learning: In GitHub Actions reusable workflows, the github context from the caller workflow is inherited by the called workflow, so github.event_name reflects the original triggering event (e.g., 'pull_request') rather than being set to 'workflow_call'. Conditions like 'github.event_name == 'pull_request'' work correctly in reusable workflows when the parent workflow was triggered by that event type.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#6681
File: .github/workflows/build-binaries.yaml:0-0
Timestamp: 2024-11-26T17:47:21.777Z
Learning: In `.github/workflows/build-binaries.yaml`, when writing shell scripts in GitHub Actions workflows, the user prefers to set environment variables individually rather than grouping them together.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6204
File: chain/api/src/config.rs:263-270
Timestamp: 2024-07-28T07:26:06.634Z
Learning: Teebor-Choka indicated that the configuration object for chain configs will be refactored in a future update.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6204
File: chain/api/src/config.rs:263-270
Timestamp: 2024-10-09T06:16:18.170Z
Learning: Teebor-Choka indicated that the configuration object for chain configs will be refactored in a future update.
.github/workflows/checks.yaml (7)
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: .github/workflows/package.yaml:28-28
Timestamp: 2025-06-19T10:07:29.649Z
Learning: In GitHub Actions reusable workflows, the github.event_name context may inherit from the parent workflow rather than being set to 'workflow_call', allowing conditions like 'github.event_name == 'pull_request'' to work correctly when the parent workflow was triggered by a pull_request event.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6366
File: ethereum/contracts/contracts-addresses.json:0-0
Timestamp: 2024-07-11T10:39:11.293Z
Learning: The user has asked to add a Git pre-commit hook to the PR to prevent changes to the `contracts-addresses.json` file.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6366
File: ethereum/contracts/contracts-addresses.json:0-0
Timestamp: 2024-10-09T06:16:18.170Z
Learning: The user has asked to add a Git pre-commit hook to the PR to prevent changes to the `contracts-addresses.json` file.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7191
File: .github/workflows/open-pr.yaml:34-43
Timestamp: 2025-06-30T08:33:20.974Z
Learning: In the hoprnet repository, the maintainer ausias-armesto prefers to add commit types to the semantic PR validation workflow incrementally as needed, rather than preemptively adding all possible types. This conservative approach keeps the workflow configuration lean.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: .github/workflows/package.yaml:28-28
Timestamp: 2025-06-19T10:08:43.091Z
Learning: In GitHub Actions reusable workflows, the github context from the caller workflow is inherited by the called workflow, so github.event_name reflects the original triggering event (e.g., 'pull_request') rather than being set to 'workflow_call'. Conditions like 'github.event_name == 'pull_request'' work correctly in reusable workflows when the parent workflow was triggered by that event type.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: .github/workflows/package.yaml:28-28
Timestamp: 2025-06-19T10:07:29.649Z
Learning: In GitHub Actions reusable workflows, the github context from the caller workflow is inherited by the called workflow, so github.event_name reflects the original triggering event (e.g., 'pull_request') rather than being set to 'workflow_call'. Conditions like 'github.event_name == 'pull_request'' work correctly in reusable workflows when the parent workflow was triggered by that event type.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: .github/workflows/package.yaml:28-28
Timestamp: 2025-06-19T10:08:43.091Z
Learning: In GitHub Actions reusable workflows, the github context from the caller workflow is inherited by the called workflow, so github.event_name reflects the original triggering event (e.g., 'pull_request') rather than being set to 'workflow_call'. Conditions like 'github.event_name == 'pull_request'' work correctly in reusable workflows when the parent workflow was triggered by that event type.
.github/workflows/checks-pre-commit.yaml (11)
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6886
File: nix/rust-package.nix:84-84
Timestamp: 2025-02-25T00:35:33.437Z
Learning: When transitioning from vendored dependencies to a private proxy registry in Rust projects, GitHub Actions workflows need to be refactored to accommodate the new update strategy, particularly workflows handling dependency updates like renovate-cargo-update.yaml.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7191
File: .github/workflows/open-pr.yaml:34-43
Timestamp: 2025-06-30T08:33:20.974Z
Learning: In the hoprnet repository, the maintainer ausias-armesto prefers to add commit types to the semantic PR validation workflow incrementally as needed, rather than preemptively adding all possible types. This conservative approach keeps the workflow configuration lean.
Learnt from: tolbrino
PR: hoprnet/hoprnet#6502
File: flake.nix:12-14
Timestamp: 2024-09-30T08:27:16.849Z
Learning: The project already has CI workflows that automatically check for compatibility issues when updating dependencies, including compiling smart contracts with new Solidity versions, running the test suite, checking for compiler warnings or deprecation notices, and reviewing changelogs for breaking changes.
Learnt from: tolbrino
PR: hoprnet/hoprnet#6502
File: flake.nix:12-14
Timestamp: 2024-10-09T06:16:18.170Z
Learning: The project already has CI workflows that automatically check for compatibility issues when updating dependencies, including compiling smart contracts with new Solidity versions, running the test suite, checking for compiler warnings or deprecation notices, and reviewing changelogs for breaking changes.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6366
File: ethereum/contracts/contracts-addresses.json:0-0
Timestamp: 2024-07-11T10:39:11.293Z
Learning: The user has asked to add a Git pre-commit hook to the PR to prevent changes to the `contracts-addresses.json` file.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6366
File: ethereum/contracts/contracts-addresses.json:0-0
Timestamp: 2024-10-09T06:16:18.170Z
Learning: The user has asked to add a Git pre-commit hook to the PR to prevent changes to the `contracts-addresses.json` file.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: .github/workflows/package.yaml:28-28
Timestamp: 2025-06-19T10:07:29.649Z
Learning: In GitHub Actions reusable workflows, the github.event_name context may inherit from the parent workflow rather than being set to 'workflow_call', allowing conditions like 'github.event_name == 'pull_request'' to work correctly when the parent workflow was triggered by a pull_request event.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7191
File: .github/workflows/open-pr.yaml:83-95
Timestamp: 2025-06-30T08:36:01.702Z
Learning: The self-hosted-hoprnet-small runners in the hoprnet repository have GitHub CLI (gh) pre-installed and available for use in workflows.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6972
File: .github/workflows/audit-pr.yaml:25-32
Timestamp: 2025-04-02T11:36:56.281Z
Learning: For HOPR projects, auditing tools like cargo-audit should be managed through the Nix environment rather than installed separately to ensure consistency and reproducibility.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6366
File: ethereum/contracts/contracts-addresses.json:0-0
Timestamp: 2024-10-09T06:16:18.170Z
Learning: Create a Git pre-commit hook to prevent changes to the `contracts-addresses.json` file.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6366
File: ethereum/contracts/contracts-addresses.json:0-0
Timestamp: 2024-07-11T10:29:02.123Z
Learning: Create a Git pre-commit hook to prevent changes to the `contracts-addresses.json` file.
🪛 actionlint (1.7.7)
.github/workflows/checks-pre-commit.yaml
22-22: label "self-hosted-hoprnet-small" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
⏰ Context from checks skipped due to timeout of 90000ms (11)
- GitHub Check: PR / Add labels
- GitHub Check: hoprd / docker
- GitHub Check: hopli / docker
- GitHub Check: Docs / Rust
- GitHub Check: Zizmor / Zizmor
- GitHub Check: Lint / Lint
- GitHub Check: Audit / Audit
- GitHub Check: Build Candidate Binaries (hoprd)
- GitHub Check: tests-unit
- GitHub Check: Build Candidate Binaries (hopli)
- GitHub Check: tests-unit-nightly
🔇 Additional comments (1)
.github/workflows/checks.yaml (1)
27-33
: Downstream jobs still run in parallel – addneeds
if you want gating
Right nowaudit
,lint
, etc. start immediately; if the intent is “fail fast on pre-commit”, wire them throughneeds: pre-commit
(or adjust matrix).Example:
audit: + needs: pre-commit
Replicate for
lint
andzizmor
.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this 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
♻️ Duplicate comments (1)
.github/workflows/checks-pre-commit.yaml (1)
30-36
: Checkout will fail when the workflow is triggered directly viamerge_group
On
merge_group
events noworkflow_call
inputs are provided, so
${{ inputs.source_repo }}
andinputs.source_branch
expand to empty strings.
actions/checkout
treats an emptyrepository
as an error and the job aborts before any pre-commit hook is executed.- repository: ${{ inputs.source_repo }} - ref: ${{ inputs.source_branch }} + repository: ${{ inputs.source_repo || github.repository }} + ref: ${{ inputs.source_branch || github.ref }}This preserves the current behaviour when the workflow is invoked via
checks.yaml
but makes stand-alonemerge_group
runs work as well.
🧹 Nitpick comments (1)
.github/workflows/checks-pre-commit.yaml (1)
24-29
: Remember to flip the egress policy toblock
once the audit period is overThe TODO is still present. Keeping the runner in audit mode indefinitely defeats the purpose of
step-security/harden-runner
. Set a calendar reminder or create a follow-up issue so this doesn’t slip through the cracks.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/checks-pre-commit.yaml
(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: tolbrino
PR: hoprnet/hoprnet#6502
File: flake.nix:12-14
Timestamp: 2024-09-30T08:27:16.849Z
Learning: The project already has CI workflows that automatically check for compatibility issues when updating dependencies, including compiling smart contracts with new Solidity versions, running the test suite, checking for compiler warnings or deprecation notices, and reviewing changelogs for breaking changes.
Learnt from: tolbrino
PR: hoprnet/hoprnet#6502
File: flake.nix:12-14
Timestamp: 2024-10-09T06:16:18.170Z
Learning: The project already has CI workflows that automatically check for compatibility issues when updating dependencies, including compiling smart contracts with new Solidity versions, running the test suite, checking for compiler warnings or deprecation notices, and reviewing changelogs for breaking changes.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7280
File: .github/workflows/checks-pre-commit.yaml:30-36
Timestamp: 2025-07-01T13:09:08.683Z
Learning: In the hoprnet repository's GitHub Actions workflow architecture, ausias-armesto prefers to centralize input resolution and fallback logic in the main checks.yaml workflow, which then calls individual reusable workflows like checks-pre-commit.yaml. The individual workflows are designed to be called primarily through the main workflow rather than directly, so fallback values in the individual workflows may be considered redundant.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7191
File: .github/workflows/open-pr.yaml:34-43
Timestamp: 2025-06-30T08:33:20.974Z
Learning: In the hoprnet repository, the maintainer ausias-armesto prefers to add commit types to the semantic PR validation workflow incrementally as needed, rather than preemptively adding all possible types. This conservative approach keeps the workflow configuration lean.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6366
File: ethereum/contracts/contracts-addresses.json:0-0
Timestamp: 2024-07-11T10:39:11.293Z
Learning: The user has asked to add a Git pre-commit hook to the PR to prevent changes to the `contracts-addresses.json` file.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6366
File: ethereum/contracts/contracts-addresses.json:0-0
Timestamp: 2024-10-09T06:16:18.170Z
Learning: The user has asked to add a Git pre-commit hook to the PR to prevent changes to the `contracts-addresses.json` file.
Learnt from: mjadach-iv
PR: hoprnet/hoprnet#6663
File: deploy/compose/.env.sample:57-57
Timestamp: 2024-11-21T13:58:22.345Z
Learning: In code reviews for this project, focus comments on the changes made in the PR, and avoid discussing unrelated code.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: .github/workflows/package.yaml:28-28
Timestamp: 2025-06-19T10:07:29.649Z
Learning: In GitHub Actions reusable workflows, the github.event_name context may inherit from the parent workflow rather than being set to 'workflow_call', allowing conditions like 'github.event_name == 'pull_request'' to work correctly when the parent workflow was triggered by a pull_request event.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6886
File: nix/rust-package.nix:84-84
Timestamp: 2025-02-25T00:35:33.437Z
Learning: When transitioning from vendored dependencies to a private proxy registry in Rust projects, GitHub Actions workflows need to be refactored to accommodate the new update strategy, particularly workflows handling dependency updates like renovate-cargo-update.yaml.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7191
File: .github/workflows/open-pr.yaml:83-95
Timestamp: 2025-06-30T08:36:01.702Z
Learning: The self-hosted-hoprnet-small runners in the hoprnet repository have GitHub CLI (gh) pre-installed and available for use in workflows.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: .github/workflows/package.yaml:28-28
Timestamp: 2025-06-19T10:07:29.649Z
Learning: In GitHub Actions reusable workflows, the github context from the caller workflow is inherited by the called workflow, so github.event_name reflects the original triggering event (e.g., 'pull_request') rather than being set to 'workflow_call'. Conditions like 'github.event_name == 'pull_request'' work correctly in reusable workflows when the parent workflow was triggered by that event type.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: .github/workflows/package.yaml:28-28
Timestamp: 2025-06-19T10:08:43.091Z
Learning: In GitHub Actions reusable workflows, the github context from the caller workflow is inherited by the called workflow, so github.event_name reflects the original triggering event (e.g., 'pull_request') rather than being set to 'workflow_call'. Conditions like 'github.event_name == 'pull_request'' work correctly in reusable workflows when the parent workflow was triggered by that event type.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: .github/workflows/package.yaml:28-28
Timestamp: 2025-06-19T10:08:43.091Z
Learning: In GitHub Actions reusable workflows, the github context from the caller workflow is inherited by the called workflow, so github.event_name reflects the original triggering event (e.g., 'pull_request') rather than being set to 'workflow_call'. Conditions like 'github.event_name == 'pull_request'' work correctly in reusable workflows when the parent workflow was triggered by that event type.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6204
File: chain/api/src/config.rs:263-270
Timestamp: 2024-07-28T07:26:06.634Z
Learning: Teebor-Choka indicated that the configuration object for chain configs will be refactored in a future update.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6204
File: chain/api/src/config.rs:263-270
Timestamp: 2024-10-09T06:16:18.170Z
Learning: Teebor-Choka indicated that the configuration object for chain configs will be refactored in a future update.
.github/workflows/checks-pre-commit.yaml (21)
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7280
File: .github/workflows/checks-pre-commit.yaml:30-36
Timestamp: 2025-07-01T13:09:08.683Z
Learning: In the hoprnet repository's GitHub Actions workflow architecture, ausias-armesto prefers to centralize input resolution and fallback logic in the main checks.yaml workflow, which then calls individual reusable workflows like checks-pre-commit.yaml. The individual workflows are designed to be called primarily through the main workflow rather than directly, so fallback values in the individual workflows may be considered redundant.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7191
File: .github/workflows/open-pr.yaml:34-43
Timestamp: 2025-06-30T08:33:20.974Z
Learning: In the hoprnet repository, the maintainer ausias-armesto prefers to add commit types to the semantic PR validation workflow incrementally as needed, rather than preemptively adding all possible types. This conservative approach keeps the workflow configuration lean.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6366
File: ethereum/contracts/contracts-addresses.json:0-0
Timestamp: 2024-07-11T10:39:11.293Z
Learning: The user has asked to add a Git pre-commit hook to the PR to prevent changes to the `contracts-addresses.json` file.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6366
File: ethereum/contracts/contracts-addresses.json:0-0
Timestamp: 2024-10-09T06:16:18.170Z
Learning: The user has asked to add a Git pre-commit hook to the PR to prevent changes to the `contracts-addresses.json` file.
Learnt from: tolbrino
PR: hoprnet/hoprnet#6502
File: flake.nix:12-14
Timestamp: 2024-09-30T08:27:16.849Z
Learning: The project already has CI workflows that automatically check for compatibility issues when updating dependencies, including compiling smart contracts with new Solidity versions, running the test suite, checking for compiler warnings or deprecation notices, and reviewing changelogs for breaking changes.
Learnt from: tolbrino
PR: hoprnet/hoprnet#6502
File: flake.nix:12-14
Timestamp: 2024-10-09T06:16:18.170Z
Learning: The project already has CI workflows that automatically check for compatibility issues when updating dependencies, including compiling smart contracts with new Solidity versions, running the test suite, checking for compiler warnings or deprecation notices, and reviewing changelogs for breaking changes.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: .github/workflows/package.yaml:28-28
Timestamp: 2025-06-19T10:07:29.649Z
Learning: In GitHub Actions reusable workflows, the github.event_name context may inherit from the parent workflow rather than being set to 'workflow_call', allowing conditions like 'github.event_name == 'pull_request'' to work correctly when the parent workflow was triggered by a pull_request event.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7191
File: .github/workflows/open-pr.yaml:83-95
Timestamp: 2025-06-30T08:36:01.702Z
Learning: The self-hosted-hoprnet-small runners in the hoprnet repository have GitHub CLI (gh) pre-installed and available for use in workflows.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6886
File: nix/rust-package.nix:84-84
Timestamp: 2025-02-25T00:35:33.437Z
Learning: When transitioning from vendored dependencies to a private proxy registry in Rust projects, GitHub Actions workflows need to be refactored to accommodate the new update strategy, particularly workflows handling dependency updates like renovate-cargo-update.yaml.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6366
File: ethereum/contracts/contracts-addresses.json:0-0
Timestamp: 2024-10-09T06:16:18.170Z
Learning: Create a Git pre-commit hook to prevent changes to the `contracts-addresses.json` file.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#6681
File: .github/workflows/build-binaries.yaml:61-97
Timestamp: 2024-11-26T17:47:32.384Z
Learning: The code in the 'Set environment variables' step in `.github/workflows/build-binaries.yaml` is obsolete and should not be reviewed in future code reviews.
Learnt from: mjadach-iv
PR: hoprnet/hoprnet#6663
File: deploy/compose/.env.sample:57-57
Timestamp: 2024-11-21T13:58:22.345Z
Learning: In code reviews for this project, focus comments on the changes made in the PR, and avoid discussing unrelated code.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7191
File: .github/workflows/build-dappnode.yaml:40-40
Timestamp: 2025-05-27T16:23:08.868Z
Learning: In the hoprnet repository's GitHub workflows, labels are passed from build.yaml to build-dappnode.yaml with a trailing comma using `format('{0},', join(github.event.pull_request.labels.*.name, ','))`. Therefore, the condition checks in build-dappnode.yaml correctly use `format('package:{0},', inputs.dappnode_repository)` with a trailing comma to match the exact label format and prevent false positives.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: .github/workflows/package.yaml:28-28
Timestamp: 2025-06-19T10:07:29.649Z
Learning: In GitHub Actions reusable workflows, the github context from the caller workflow is inherited by the called workflow, so github.event_name reflects the original triggering event (e.g., 'pull_request') rather than being set to 'workflow_call'. Conditions like 'github.event_name == 'pull_request'' work correctly in reusable workflows when the parent workflow was triggered by that event type.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: .github/workflows/package.yaml:28-28
Timestamp: 2025-06-19T10:08:43.091Z
Learning: In GitHub Actions reusable workflows, the github context from the caller workflow is inherited by the called workflow, so github.event_name reflects the original triggering event (e.g., 'pull_request') rather than being set to 'workflow_call'. Conditions like 'github.event_name == 'pull_request'' work correctly in reusable workflows when the parent workflow was triggered by that event type.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: .github/workflows/package.yaml:28-28
Timestamp: 2025-06-19T10:08:43.091Z
Learning: In GitHub Actions reusable workflows, the github context from the caller workflow is inherited by the called workflow, so github.event_name reflects the original triggering event (e.g., 'pull_request') rather than being set to 'workflow_call'. Conditions like 'github.event_name == 'pull_request'' work correctly in reusable workflows when the parent workflow was triggered by that event type.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6545
File: transport/p2p/src/swarm.rs:491-494
Timestamp: 2024-10-11T10:43:34.869Z
Learning: When reviewing revert pull requests in the `hoprnet/hoprnet` repository, avoid making code recommendations or suggestions.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#7231
File: flake.nix:599-608
Timestamp: 2025-06-11T13:34:45.385Z
Learning: The repository intentionally relies on Commitizen’s default configuration; absence of a `.cz.*` file or `[tool.commitizen]` section is expected and should not be flagged in future reviews.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6366
File: ethereum/contracts/contracts-addresses.json:0-0
Timestamp: 2024-07-11T10:29:02.123Z
Learning: Create a Git pre-commit hook to prevent changes to the `contracts-addresses.json` file.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6379
File: .github/scripts/immutable-files-check.sh:1-1
Timestamp: 2024-07-11T12:39:43.940Z
Learning: The `git diff --name-only HEAD` command is used to check for changes between the working directory and the last commit, which is appropriate for preventing committed changes.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6379
File: .github/scripts/immutable-files-check.sh:1-1
Timestamp: 2024-10-09T06:16:23.638Z
Learning: The `git diff --name-only HEAD` command is used to check for changes between the working directory and the last commit, which is appropriate for preventing committed changes.
🪛 actionlint (1.7.7)
.github/workflows/checks-pre-commit.yaml
22-22: label "self-hosted-hoprnet-small" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
⏰ Context from checks skipped due to timeout of 90000ms (10)
- GitHub Check: Zizmor / Zizmor
- GitHub Check: Audit / Audit
- GitHub Check: Lint / Lint
- GitHub Check: hoprd / docker
- GitHub Check: hopli / docker
- GitHub Check: Docs / Rust
- GitHub Check: Build Candidate Binaries (hoprd)
- GitHub Check: Build Candidate Binaries (hopli)
- GitHub Check: tests-unit
- GitHub Check: tests-unit-nightly
🔇 Additional comments (1)
.github/workflows/checks-pre-commit.yaml (1)
49-50
: 👍 Correct CI-style invocation ofpre-commit
Running
pre-commit run --all-files --show-diff-on-failure
guarantees non-interactive execution and fails the job on hook errors.
This pull request introduces a new pre-commit workflow to streamline checks before merging and integrates it into the existing
checks.yaml
workflow. The changes focus on defining the pre-commit workflow and ensuring it is properly linked and configured.New Pre-commit Workflow:
.github/workflows/checks-pre-commit.yaml
: Added a new pre-commit workflow that runs onmerge_group
events and uses self-hosted runners. It includes steps for hardening the runner, checking out the repository, installing Nix, setting up Cachix, and running pre-commit checks.Integration with Existing Workflow:
.github/workflows/checks.yaml
: Integrated the pre-commit workflow into the mainchecks.yaml
file by adding a newpre-commit
job that uses the newly createdchecks-pre-commit.yaml
workflow. It passes the source repository and branch as inputs and inherits secrets.