-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chore/preserve-component-data
- Loading branch information
Showing
136 changed files
with
4,327 additions
and
1,683 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Manage Review Labels | ||
|
||
on: | ||
pull_request_review: | ||
types: [submitted] | ||
|
||
jobs: | ||
label-on-review: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
issues: write | ||
steps: | ||
- name: Manage LGTM Review Label | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const LGTM_LABEL = 'lgtm'; | ||
// Extract review details | ||
const { state: reviewState } = context.payload.review; | ||
const pullRequestNumber = context.payload.pull_request.number; | ||
const repoDetails = { | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: pullRequestNumber | ||
}; | ||
// Log review information | ||
console.log(`Processing review for PR #${pullRequestNumber}`); | ||
console.log(`Review state: ${reviewState}`); | ||
// Helper function to check for LGTM label | ||
async function hasLgtmLabel() { | ||
const { data: labels } = await github.rest.issues.listLabelsOnIssue(repoDetails); | ||
return labels.some(label => label.name === LGTM_LABEL); | ||
} | ||
if (reviewState === 'approved') { | ||
const lgtmExists = await hasLgtmLabel(); | ||
if (!lgtmExists) { | ||
console.log(`Adding ${LGTM_LABEL} label to PR #${pullRequestNumber}`); | ||
await github.rest.issues.addLabels({ | ||
...repoDetails, | ||
labels: [LGTM_LABEL] | ||
}); | ||
console.log('Label added successfully'); | ||
} else { | ||
console.log(`${LGTM_LABEL} label already exists`); | ||
} | ||
} else if (reviewState === 'changes_requested') { | ||
const lgtmExists = await hasLgtmLabel(); | ||
if (lgtmExists) { | ||
console.log(`Removing ${LGTM_LABEL} label from PR #${pullRequestNumber}`); | ||
await github.rest.issues.removeLabel({ | ||
...repoDetails, | ||
name: LGTM_LABEL | ||
}); | ||
console.log('Label removed successfully'); | ||
} else { | ||
console.log(`No ${LGTM_LABEL} label to remove`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.