Add workflow to label PRs with merge conflicts (#342)
* fix(#65): request POST_NOTIFICATIONS runtime permission on Android 13+ On API 33+ the manifest declaration alone is not enough — the app must request POST_NOTIFICATIONS via ActivityResultContracts.RequestPermission at runtime before it can show any notification, including the foreground service notification from ChatNotificationService. - Added rememberLauncherForActivityResult for POST_NOTIFICATIONS - Added LaunchedEffect(Unit) that fires the permission request on first composition when running on API 33+ and permission is not yet granted - The next lifecycle event (ON_STOP → NotificationHelper.start) picks up the permission if granted * fix: add missing import android.os.Build for POST_NOTIFICATIONS permission check * fix: add missing import for rememberLauncherForActivityResult (androidx.activity.compose) * Add GitHub workflow to check PR for linked issue * Add workflow to label PRs with merge conflicts * Remove pr-issue-check.yml, keep only merge-conflict-label workflow * Remove issue-tag.yml, keep only merge-conflict-label workflow in PR --------- Co-authored-by: M57 <hy4ri@users.noreply.github.com> Co-authored-by: Hermes Agent <hermes@m57.local> Co-authored-by: Hermes Agent <hermes@agent.local>
This commit is contained in:
1 file changed
+56
@@ -0,0 +1,56 @@
|
|||||||
|
name: Label PR merge conflicts
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize, reopened, ready_for_review]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
label-conflict:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
contents: read
|
||||||
|
steps:
|
||||||
|
- name: Get PR data and label conflicts
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const pr = context.payload.pull_request;
|
||||||
|
const prNumber = pr.number;
|
||||||
|
const repo = context.repo;
|
||||||
|
|
||||||
|
// Fetch PR details to get mergeable_state
|
||||||
|
const { data: prData } = await github.rest.pulls.get({
|
||||||
|
...repo,
|
||||||
|
pull_number: prNumber
|
||||||
|
});
|
||||||
|
|
||||||
|
const mergeableState = prData.mergeable_state; // clean, dirty, blocked, unstable
|
||||||
|
const hasConflict = mergeableState === 'dirty';
|
||||||
|
|
||||||
|
const labelName = 'merge-conflict';
|
||||||
|
|
||||||
|
// Get current labels
|
||||||
|
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
|
||||||
|
...repo,
|
||||||
|
issue_number: prNumber
|
||||||
|
});
|
||||||
|
const hasLabel = labels.some(l => l.name === labelName);
|
||||||
|
|
||||||
|
if (hasConflict && !hasLabel) {
|
||||||
|
console.log(`PR #${prNumber} has merge conflicts. Adding label '${labelName}'.`);
|
||||||
|
await github.rest.issues.addLabels({
|
||||||
|
...repo,
|
||||||
|
issue_number: prNumber,
|
||||||
|
labels: [labelName]
|
||||||
|
});
|
||||||
|
} else if (!hasConflict && hasLabel) {
|
||||||
|
console.log(`PR #${prNumber} no longer has merge conflicts. Removing label '${labelName}'.`);
|
||||||
|
await github.rest.issues.removeLabel({
|
||||||
|
...repo,
|
||||||
|
issue_number: prNumber,
|
||||||
|
name: labelName
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log(`PR #${prNumber}: conflict=${hasConflict}, label=${hasLabel}. No change needed.`);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user