Skip to content

[LinearSolver] Renamed ShewchuckPCGLinearSolver by removing the Shewchuck #3983

[LinearSolver] Renamed ShewchuckPCGLinearSolver by removing the Shewchuck

[LinearSolver] Renamed ShewchuckPCGLinearSolver by removing the Shewchuck #3983

---
name: PR check - Labels
on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
jobs:
check_labels:
name: Check labels
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'sofa-framework' }}
steps:
- name: Delay for 10 Seconds
run: |
echo "Waiting for 10 seconds in case other labels get changed"
sleep 10
- name: Check Labels and Add Comment
id: check_labels_and_comment
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
// Get PR info: id and labels
const prNumber = context.payload.pull_request.number;
const labels = context.payload.pull_request.labels.map(label => label.name);
// Define an array of descriptive labels
const descriptiveLabels = [
'enhancement',
'deprecated',
'refactoring',
'pr: breaking',
'pr: clean',
'pr: fix',
'pr: new feature',
'pr: test'
];
// Check if any descriptive label is included in the 'labels' array
const hasDescriptiveLabel = labels.some(label => descriptiveLabels.includes(label));
// If no descriptive label is set, add a comment in the PR and make the action check fail
if (!hasDescriptiveLabel) {
const comment = ':warning: :warning: :warning:<br>@' + context.payload.pull_request.user.login + ' your PR does not include any **descriptive** label :label:<br> Make sure to add an appropriate [PR label](https://github.com/sofa-framework/sofa/labels) before merge.<br>:warning: :warning: :warning:';
github.issues.createComment({
issue_number: prNumber,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
core.setFailed('Invalid PR label');
}
// Array of possible labels defining the status of the PR
const statusLabels = [
'pr: status wip',
'pr: status to review',
'pr: status ready'
];
// Filter the labels array to get only the status labels
const matchingStatusLabels = labels.filter(label => statusLabels.includes(label));
// Count the number of entries in 'matchingLabels'
const matchingLabelsCount = matchingStatusLabels.length;
// If no descriptive label is set, add a comment in the PR and make the action check fail
if (matchingLabelsCount === 0) {
const comment = ':warning: :warning: :warning:<br>@'+context.repo.owner+' your PR does not include any **status** label :label:<br> Make sure to add one (wip, to review or ready).<br>:warning: :warning: :warning:';
github.issues.createComment({
issue_number: prNumber,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
core.setFailed('Missing status PR label')
} else if (matchingLabelsCount > 1) {
const comment = ':warning: :warning: :warning:<br>@'+context.repo.owner+' your PR does includes **too many status labels** :label:<br> Make sure to keep only one (wip, to review or ready).<br>:warning: :warning: :warning:';
github.issues.createComment({
issue_number: prNumber,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
core.setFailed('Too many status PR labels')
}
// Add all PR labels in log
console.log('Labels:', labels.join(', '));