Skip to content

fix(ci): Make sure to checkout the PR branch before pushing the diff generated from the pre-commit hooks#230

Merged
rm3l merged 1 commit intoredhat-developer:mainfrom
rm3l:fix/fix_detached_state_when_pushing_bundle_diff
Sep 8, 2025
Merged

fix(ci): Make sure to checkout the PR branch before pushing the diff generated from the pre-commit hooks#230
rm3l merged 1 commit intoredhat-developer:mainfrom
rm3l:fix/fix_detached_state_when_pushing_bundle_diff

Conversation

@rm3l
Copy link
Copy Markdown
Member

@rm3l rm3l commented Sep 8, 2025

Description of the change

Applying the same fix done in redhat-developer/rhdh-operator#1599

Context:

This only affects workflows that have steps that auto-commit/push certain changes to the PR branch.

Which issue(s) does this PR fix or relate to

https://github.com/redhat-developer/rhdh-chart/actions/runs/17545997169/job/49827512012?pr=231

How to test changes / Special notes to the reviewer

Checklist

  • For each Chart updated, version bumped in the corresponding Chart.yaml according to Semantic Versioning.
  • For each Chart updated, variables are documented in the values.yaml and added to the corresponding README.md. The pre-commit utility can be used to generate the necessary content. Use pre-commit run -a to apply changes. The pre-commit Workflow will do this automatically for you if needed.
  • JSON Schema template updated and re-generated the raw schema via the pre-commit hook.
  • Tests pass using the Chart Testing tool and the ct lint command.
  • If you updated the orchestrator-infra chart, make sure the versions of the Knative CRDs are aligned with the versions of the CRDs installed by the OpenShift Serverless operators declared in the values.yaml file. See Installing Knative Eventing and Knative Serving CRDs for more details.

Summary by Sourcery

Update the pre-commit GitHub Actions workflow to checkout the PR head branch before committing and pushing auto-fix changes, and refresh the internal approvers list.

CI:

  • Ensure the workflow fetches and checks out the PR branch from the fork remote before committing and pushing pre-commit hook fixes
  • Remove 'coreydaley' from the internal approvers list in the pre-commit workflow

Summary by Sourcery

Fix pre-commit GitHub workflow to correctly check out and push auto-generated fixes back to the pull request branch.

Bug Fixes:

  • Ensure the workflow fetches and checks out the PR head before committing and pushing pre-commit hook changes.

Enhancements:

  • Streamline the internal approvers list for environment selection.
  • Remove unnecessary git fetch/pull steps and update push command to target the PR branch.

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `.github/workflows/pre-commit.yaml:24` </location>
<code_context>
     environment:
       ${{ (github.event.pull_request.head.repo.full_name == github.repository ||
-      contains(fromJSON('["coreydaley","gazarenkov","kadel","nickboldt","rm3l","kim-tsao","Fortune-Ndlovu","subhashkhileri","zdrapela","openshift-cherrypick-robot", "Fortune-Ndlovu", "subhashkhileri", "zdrapela"]'), github.event.pull_request.user.login)) && 'internal' || 'external' }}
+      contains(fromJSON('["gazarenkov","kadel","nickboldt","rm3l","kim-tsao","Fortune-Ndlovu","subhashkhileri","zdrapela","openshift-cherrypick-robot", "Fortune-Ndlovu", "subhashkhileri", "zdrapela"]'), github.event.pull_request.user.login)) && 'internal' || 'external' }}
     runs-on: ubuntu-latest
     steps:
</code_context>

<issue_to_address>
Duplicate entries in the approvers list may be unnecessary.

Consider removing the duplicate names to improve maintainability and readability.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .github/workflows/pre-commit.yaml Outdated
@rm3l rm3l force-pushed the fix/fix_detached_state_when_pushing_bundle_diff branch from 0ce599e to 285697b Compare September 8, 2025 09:23
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Sep 8, 2025

Quality Gate Passed Quality Gate passed

Issues
0 New issues
3 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

Comment thread .github/workflows/pre-commit.yaml Dismissed
Comment thread .github/workflows/pre-commit.yaml Dismissed
Comment thread .github/workflows/pre-commit.yaml Dismissed
@rm3l
Copy link
Copy Markdown
Member Author

rm3l commented Sep 8, 2025

@sourcery-ai review

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `.github/workflows/pre-commit.yaml:79` </location>
<code_context>
-          git fetch --prune
-          git pull --rebase --autostash
+
           git add -A .
           git commit \
             -m "chore(pre-commit): Auto-fix hooks" \
             -m "Co-authored-by: $GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>"
</code_context>

<issue_to_address>
Using 'git add -A .' may stage unintended changes outside manifests.

Restrict the 'git add' path to only include manifest files to avoid staging unrelated changes.

Suggested implementation:

```
          git add **/manifest*.yml **/manifests/*.yml **/manifests/*.yaml

```

- Adjust the glob pattern(s) in the `git add` command to match the actual location and naming of your manifest files. For example, if your manifests are in a specific directory or have a different naming convention, update the pattern accordingly.
- If you have multiple types of manifest files (e.g., `.json`, `.yaml`, `.yml`), add those extensions as needed.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .github/workflows/pre-commit.yaml
@rm3l
Copy link
Copy Markdown
Member Author

rm3l commented Sep 8, 2025

/cherry-pick releae-1.6
/cherry-pick release-1.7

@openshift-cherrypick-robot
Copy link
Copy Markdown

@rm3l: once the present PR merges, I will cherry-pick it on top of releae-1.6, release-1.7 in new PRs and assign them to you.

Details

In response to this:

/cherry-pick releae-1.6
/cherry-pick release-1.7

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@rm3l rm3l merged commit 1d2eff6 into redhat-developer:main Sep 8, 2025
7 of 8 checks passed
@rm3l rm3l deleted the fix/fix_detached_state_when_pushing_bundle_diff branch September 8, 2025 09:28
@openshift-cherrypick-robot
Copy link
Copy Markdown

@rm3l: cannot checkout releae-1.6: error checking out "releae-1.6": exit status 1 error: pathspec 'releae-1.6' did not match any file(s) known to git

Details

In response to this:

/cherry-pick releae-1.6
/cherry-pick release-1.7

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-cherrypick-robot
Copy link
Copy Markdown

@rm3l: new pull request created: #232

Details

In response to this:

/cherry-pick releae-1.6
/cherry-pick release-1.7

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@rm3l
Copy link
Copy Markdown
Member Author

rm3l commented Sep 8, 2025

/cherry-pick release-1.6

@openshift-cherrypick-robot
Copy link
Copy Markdown

@rm3l: #230 failed to apply on top of branch "release-1.6":

Applying: fix(ci): Make sure to checkout the PR branch before pushing the diff generated from the pre-commit hooks
Using index info to reconstruct a base tree...
A	.github/workflows/pre-commit.yaml
Falling back to patching base and 3-way merge...
CONFLICT (modify/delete): .github/workflows/pre-commit.yaml deleted in HEAD and modified in fix(ci): Make sure to checkout the PR branch before pushing the diff generated from the pre-commit hooks. Version fix(ci): Make sure to checkout the PR branch before pushing the diff generated from the pre-commit hooks of .github/workflows/pre-commit.yaml left in tree.
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 fix(ci): Make sure to checkout the PR branch before pushing the diff generated from the pre-commit hooks

Details

In response to this:

/cherry-pick release-1.6

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@rm3l
Copy link
Copy Markdown
Member Author

rm3l commented Sep 8, 2025

Cherry-picking to release-1.6 not needed. This workflow is not present in this branch.

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.

3 participants