-
-
Notifications
You must be signed in to change notification settings - Fork 47
feat: add merge conflict labelling workflow #131
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,29 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Label Merge Conflicts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pull_request_target: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| types: [opened, reopened, synchronize] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pull-requests: write | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| label-conflicts: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Label PRs with merge conflicts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: eps1lon/actions-label-merge-conflict@v3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dirtyLabel: "PR has merge conflicts" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| repoToken: "${{ secrets.GITHUB_TOKEN }}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+16
to
+20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Description: Verify the action exists and check for the latest stable version
echo "Fetching repository information for eps1lon/actions-label-merge-conflict..."
gh api repos/eps1lon/actions-label-merge-conflict --jq '{name: .name, default_branch: .default_branch, archived: .archived}'
echo -e "\nFetching available tags/releases..."
gh api repos/eps1lon/actions-label-merge-conflict/tags --jq '.[0:5] | .[] | {name: .name, commit: .commit.sha}'
echo -e "\nChecking for v3 tag specifically..."
gh api repos/eps1lon/actions-label-merge-conflict/git/ref/tags/v3 --jq '{ref: .ref, sha: .object.sha}' 2>&1 || echo "v3 tag not found"Repository: AOSSIE-Org/SocialShareButton Length of output: 684 🌐 Web query:
💡 Result: eps1lon/actions-label-merge-conflict is a GitHub Action that automatically adds a specified label to pull requests (PRs) when they have merge conflicts and removes it when conflicts are resolved. It also supports removing another label on conflict and optionally posting comments. Key features: - Adds 'dirtyLabel' (required) to PRs with conflicts; removes it when clean. - Removes 'removeOnDirtyLabel' (optional) when conflicting. - Posts customizable comments: 'commentOnDirty' and 'commentOnClean'. - Optimized to check only relevant PRs affected by pushes. - Uses GitHub's mergeable state; retries up to 'retryMax' (default 5) times. Usage example in .github/workflows/maintenance.yml: name: Maintenance on: push: pull_request_target: types: [synchronize] jobs: main: runs-on: ubuntu-latest steps: - name: check if prs are dirty uses: eps1lon/actions-label-merge-conflict@v3 with: dirtyLabel: 'PR: needs rebase' removeOnDirtyLabel: 'PR: ready to ship' repoToken: ${{ secrets.GITHUB_TOKEN }} commentOnDirty: 'This pull request has conflicts, please resolve those before we can evaluate the pull request.' commentOnClean: 'Conflicts have been resolved. A maintainer will review the pull request shortly.' Repo stats: 61 stars, TypeScript, latest release v3.0.3 (2025-01-06), last push 2026-03-13. Use Citations:
🌐 Web query:
💡 Result: For GitHub Actions best practices on version pinning, prioritize pinning to full-length commit SHAs over version tags for maximum security, especially for third-party actions. This provides immutability, preventing supply chain attacks where tags are moved to malicious commits. Key points: - Official GitHub recommendation: "Pin actions to a full-length commit SHA is currently the only way to use an action as an immutable release." This mitigates risks from backdoors, as attackers would need a SHA-1 collision. - SHA vs Tags: Tags (e.g., Citations:
Consider pinning to a commit SHA for enhanced security. The workflow uses 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| commentOnDirty: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ⚠️ **This PR has merge conflicts.** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Please resolve the merge conflicts before review. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Your PR will only be reviewed by a maintainer after all conflicts have been resolved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 📺 Watch this video to understand why conflicts occur and how to resolve them: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| https://www.youtube.com/watch?v=Sqsz1-o7nXk | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+16
to
+29
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider adding a While the workflow posts a helpful comment when conflicts are detected, it doesn't notify contributors when conflicts are resolved. Adding a ✨ Optional enhancement - name: Label PRs with merge conflicts
uses: eps1lon/actions-label-merge-conflict@v3
with:
dirtyLabel: "PR has merge conflicts"
repoToken: "${{ secrets.GITHUB_TOKEN }}"
commentOnDirty: |
⚠️ **This PR has merge conflicts.**
Please resolve the merge conflicts before review.
Your PR will only be reviewed by a maintainer after all conflicts have been resolved.
📺 Watch this video to understand why conflicts occur and how to resolve them:
https://www.youtube.com/watch?v=Sqsz1-o7nXk
+ commentOnClean: |
+ ✅ **Merge conflicts have been resolved.**
+
+ This PR is now ready for review by a maintainer.📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
Remove the unnecessary
pushtrigger.The
pushtrigger will cause this workflow to run on every commit to any branch, including direct commits that are unrelated to pull requests. Since theeps1lon/actions-label-merge-conflictaction is designed to detect and label merge conflicts in PRs, thepushtrigger adds minimal value while consuming CI resources unnecessarily.The
pull_request_targettrigger already handles all relevant PR events (opened, reopened, synchronize).🔧 Proposed fix
on: - push: pull_request_target: types: [opened, reopened, synchronize]📝 Committable suggestion
🤖 Prompt for AI Agents