-
Notifications
You must be signed in to change notification settings - Fork 8
chore: 👷 Add repository condition to CI workflows… #1905
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
Changed Files
|
Reviewer's GuideThis PR updates CI workflows by adding repository-specific guards and emoji-enhanced naming to existing jobs, and introduces a new GitLab mirror workflow to push branches, tags, and PR source branches to a GitLab mirror. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1905 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 63 63
Lines 5882 5882
=========================================
Hits 5882 5882
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
…and branch management
… and error checks for pull requests and tags
|
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.
Hey @Anselmoo - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 4 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| if [ -z "$GITLAB_USERNAME" ] || [ -z "$GITLAB_TOKEN" ] || [ -z "$GITLAB_PROJECT_PATH" ]; then | ||
| echo "❌ Error: Missing required GitLab credentials or project path." | ||
| echo "Please set GITLAB_USERNAME, GITLAB_TOKEN, and GITLAB_PROJECT_PATH secrets." |
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.
suggestion: Secret validation only checks for presence, not for empty values.
Add checks to ensure each secret is not only set but also non-empty to prevent the script from proceeding with empty values.
| if [ -z "$GITLAB_USERNAME" ] || [ -z "$GITLAB_TOKEN" ] || [ -z "$GITLAB_PROJECT_PATH" ]; then | |
| echo "❌ Error: Missing required GitLab credentials or project path." | |
| echo "Please set GITLAB_USERNAME, GITLAB_TOKEN, and GITLAB_PROJECT_PATH secrets." | |
| # Ensure secrets are provided and non-empty (not just set) | |
| if [ -z "${GITLAB_USERNAME// }" ] || [ -z "${GITLAB_TOKEN// }" ] || [ -z "${GITLAB_PROJECT_PATH// }" ]; then | |
| echo "❌ Error: Missing or empty GitLab credentials or project path." | |
| echo "Please ensure GITLAB_USERNAME, GITLAB_TOKEN, and GITLAB_PROJECT_PATH are set and non-empty." |
| # Add GitLab remote with credentials | ||
| echo "📝 Adding GitLab remote..." | ||
| GITLAB_URL="https://${GITLAB_USERNAME}:${GITLAB_TOKEN}@${GITLAB_HOSTNAME}/${GITLAB_PROJECT_PATH}.git" | ||
| git remote add gitlab "${GITLAB_URL}" |
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.
issue (bug_risk): No check for existing 'gitlab' remote before adding.
Verify if a 'gitlab' remote already exists and remove or update it before adding, to prevent failures on reruns.
| echo "🔄 Processing pull request #$PR_NUMBER from $SOURCE_BRANCH to $TARGET_BRANCH" | ||
|
|
||
| # Check if PR source branch exists locally | ||
| if git show-ref --verify --quiet "refs/remotes/origin/$SOURCE_BRANCH"; then |
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.
issue (bug_risk): PR source branch check may not work for forks.
The 'refs/remotes/origin/$SOURCE_BRANCH' check skips forked PRs since their branches aren’t local. Ensure fork branches are fetched or handled.
| fi | ||
| else | ||
| echo "🆕 Branch $CURRENT_BRANCH does not exist on GitLab. Creating it..." | ||
| git push gitlab "$CURRENT_BRANCH" |
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.
suggestion (bug_risk): Initial branch push does not handle protected branches.
Catch push failures when the GitLab branch is protected or restricted and provide clear error messages.
… for 'Anselmoo/spectrafit'
All PR-Submissions:
Pull Requests for the same
update/change?
New ✨✨ Feature-Submissions:
Changes to ⚙️ Core-Features:
us to include them?
Summary by Sourcery
Enhance GitHub Actions by restricting runs to the main repository, unifying naming conventions with emojis for improved readability, introduce a GitLab mirroring workflow, and adjust existing workflows (dependency updates, CI, CD) accordingly.
New Features:
Enhancements:
if: github.repository == 'Anselmoo/spectrafit'guards to CI jobs to prevent them from running on forks.CI: