Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion .github/workflows/pull_request_random_reviewer_assignment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,33 @@ jobs:
repo: context.repo.repo,
labels: ['pending/review']
});




- name: Check if the PR author is an organization member and add as assignee
uses: actions/github-script@v6
with:
script: |
const prAuthor = context.payload.pull_request.user.login;
const org = context.repo.owner;
const prNumber = context.payload.pull_request.number;

// Check if the PR author is a member of the organization
try {
await github.rest.orgs.checkMembershipForUser({
org,
username: prAuthor
});

// If the check doesn't throw an error, the user is a member
// Add the PR author as an assignee
await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
assignees: [prAuthor]
});
} catch (error) {
// If the user is not a member, or any other error occurs, do nothing
console.log(`User ${prAuthor} is not a member of the org, or an error occurred: ${error.message}`);
}
23 changes: 19 additions & 4 deletions .github/workflows/pull_request_review_labeler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request_review:
types: [submitted, edited, dismissed]
pull_request_target:
types: [synchronize]
types: [synchronize, reopened]

jobs:
update-labels:
Expand All @@ -24,7 +24,22 @@ jobs:
});

const hasPendingReview = currentLabels.some(label => label.name === 'pending/review');
const reviewState = context.payload.review.state;
let reviewState = context.payload.review?.state
// If there is no review object, it might be a different event type
if (!reviewState) {
// Fetch the latest review state from the PR
const reviews = await github.rest.pulls.listReviews({
owner,
repo,
pull_number: prNumber
});

// If there are any reviews, get the state of the latest one
if (reviews.data.length > 0) {
const latestReview = reviews.data[reviews.data.length - 1];
reviewState = latestReview.state.toLowerCase();
}
}

// Remove 'pending/review' label if it exists and the review state is not 'pending'
if (hasPendingReview && reviewState !== 'pending') {
Expand All @@ -48,12 +63,12 @@ jobs:
}

// Re-add 'pending/review' label if PR is synchronized and no reviews are pending
if (context.eventName === 'pull_request_target' && context.payload.action === 'synchronize' && !hasPendingReview) {
if (context.eventName === 'pull_request_target' && !hasPendingReview) {
await github.rest.issues.addLabels({
owner,
repo,
issue_number: prNumber,
labels: ['pending/review']
});
}


Original file line number Diff line number Diff line change
Expand Up @@ -391,15 +391,15 @@ watch(() => storeState.isEventRuleEditMode, (isEditMode) => {
}
.merge-asset {
@apply flex items-center flex-1 gap-3;
.input-box {
@apply inline-block flex-1;
margin-bottom: 0;
.merge-asset-labels {
.unit {
@apply text-label-md text-gray-400;
margin-top: -0.125rem;
line-height: 1rem;
}
}
.input-box {
@apply inline-block flex-1;
margin-bottom: 0;
.merge-asset-labels {
.unit {
@apply text-label-md text-gray-400;
margin-top: -0.125rem;
line-height: 1rem;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/store/reference/collector-reference-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const useCollectorReferenceStore = defineStore('reference-collector', ()
const referenceMap: CollectorReferenceMap = {};
try {
const isAlertManagerVersionV2 = (config.get('ADVANCED_SERVICE')?.alert_manager_v2 ?? []).includes(domainStore.state.domainId);
const collectorFetcher = isAlertManagerVersionV2 ? SpaceConnector.clientV2.inventoryV2.collector.list : SpaceConnector.clientV2.inventory.collector.list;
const collectorFetcher = !isAlertManagerVersionV2 ? SpaceConnector.clientV2.inventoryV2.collector.list : SpaceConnector.clientV2.inventory.collector.list;

const response = await collectorFetcher<CollectorListParameters, ListResponse<CollectorModel>>({
query: {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/store/reference/region-reference-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const useRegionReferenceStore = defineStore('reference-region', () => {
const referenceMap: RegionReferenceMap = {};
try {
const isAlertManagerVersionV2 = (config.get('ADVANCED_SERVICE')?.alert_manager_v2 ?? []).includes(domainStore.state.domainId);
const regionFetcher = isAlertManagerVersionV2 ? SpaceConnector.clientV2.inventoryV2.region.list : SpaceConnector.clientV2.inventory.region.list;
const regionFetcher = !isAlertManagerVersionV2 ? SpaceConnector.clientV2.inventoryV2.region.list : SpaceConnector.clientV2.inventory.region.list;

const response = await regionFetcher<RegionListParameters, ListResponse<RegionModel>>({
query: {
Expand Down