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

Skipping SonarQube analysis on fork repos and adding POWPEG_REPO_OWNER input #316

Merged
merged 3 commits into from
Oct 11, 2024

Conversation

rmoreliovlabs
Copy link
Contributor

Description

Right now, checks for pull requests (PRs) from external contributors using forked repositories are not passing. The main issue is that the rootstock-integration-tests workflow is attempting to find the branch in the original rsksmart/powpeg repository instead of the contributor's fork. Here are the specific problems we've encountered:

Git Checkout Error: error: pathspec 'vovchyk/status-badge' did not match any file(s) known to git
and

SonarQube Execution Error: Execution failed for task '
'.Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, the 'SONAR_TOKEN' environment variable, or contact the project administrator to check the permissions of the user the token belongs to.

It appears that the SonarQube check is being triggered automatically for external PRs of branches from forked repos, which should not happen due to potential access issues

Implementation

Updated rit.yml Workflow:
Added the repo-owner input to the Rootstock Integration Tests action to ensure it correctly clones the repository based on the PR's owner:

- name: Run Rootstock Integration Tests
  uses: rmoreliovlabs/rootstock-integration-tests@feature/add_repo_owner_input
  with:
    rskj-branch: ${{ env.RSKJ_BRANCH }}
    powpeg-node-branch: ${{ env.POWPEG_BRANCH }}
    rit-branch: ${{ env.RIT_BRANCH }}
    powpeg-repo-owner: ${{ env.POWPEG_REPO_OWNER }}

Conditionally Trigger SonarQube Check:

Implemented logic to skip the SonarQube check for PRs from external contributors. This prevents unnecessary execution that could fail due to access issues.
if [ "$GH_EVENT" = pull_request ] && [ "${{ github.event.pull_request.head.repo.fork }}" != "true" ]; then

For more context, check the rskj pr here

@rmoreliovlabs rmoreliovlabs deleted the feature/adding_repo_owner_input branch October 4, 2024 14:12
@rmoreliovlabs rmoreliovlabs restored the feature/adding_repo_owner_input branch October 7, 2024 13:13
@rmoreliovlabs rmoreliovlabs reopened this Oct 7, 2024
@rmoreliovlabs rmoreliovlabs force-pushed the feature/adding_repo_owner_input branch from d34824d to 504c82c Compare October 7, 2024 13:57
@rmoreliovlabs rmoreliovlabs marked this pull request as ready for review October 7, 2024 13:57
@rmoreliovlabs rmoreliovlabs requested a review from a team as a code owner October 7, 2024 13:57
@rmoreliovlabs rmoreliovlabs requested review from fmacleal, Vovchyk and lucasvuotto and removed request for a team October 7, 2024 13:57
fmacleal
fmacleal previously approved these changes Oct 9, 2024
Copy link
Contributor

@fmacleal fmacleal left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

sonarcloud bot commented Oct 11, 2024

@marcos-iov marcos-iov merged commit 38135a6 into master Oct 11, 2024
8 checks passed
@marcos-iov marcos-iov deleted the feature/adding_repo_owner_input branch October 11, 2024 15:09
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