From 8f2caba4a5a51448730c77ac1e7db5ed47999318 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 7 Aug 2021 17:46:29 +0200 Subject: [PATCH] Governance Update Testing gov.prs 15 --- Client/httpInterface.js | 35 ++++++++++++++++--- .../User-Profiles/Luis-Fernando-Molina.json | 2 +- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Client/httpInterface.js b/Client/httpInterface.js index 331f6ca66..b93c97662 100644 --- a/Client/httpInterface.js +++ b/Client/httpInterface.js @@ -1328,6 +1328,31 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE */ if (listResponse.data.length !== 1) { console.log('[INFO] httpInterface -> Gov -> mergeGithubPullRequests -> Validation #1 Failed -> Pull Request "' + pullRequest.title + '" not merged because it contains more than 1 file. -> fileCount = ' + listResponse.data.length) + /* + We will close PRs that contains any User Profile file together with other files in the same Pull Request. + This will avoid manual merges to include User Profile files. + */ + for (j = 0; j < listResponse.data.length; j++) { + let pullRequestFile = listResponse.data[j] + if (pullRequestFile.indexOf('Governance/Plugins/User-Profiles') >= 0) { + await sleep(GITHUB_API_WAITING_TIME) + await octokit.rest.issues.createComment({ + owner: owner, + repo: repo, + issue_number: pullRequest.number, + body: 'This Pull Request could not be automatically merged and was closed by the Superalgos Governance System because it was detected that a User Profile file "' + pullRequestFile + '" was submitted it together with ' + listResponse.data.length + ' other files. User Profiles files as per the Governance System rules, must be the only file present at a Pull Request in order to pass all the validations and be automatically merged.' + }); + + await sleep(GITHUB_API_WAITING_TIME) + await octokit.rest.pulls.update({ + owner: owner, + repo: repo, + pull_number: pullRequest.number, + state: 'closed' + }); + break + } + } continue } let pullRequestFile = listResponse.data[0] @@ -1363,14 +1388,14 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE let messageSigned = config.signature.message if (messageSigned !== githubUsername) { console.log('[INFO] httpInterface -> Gov -> mergeGithubPullRequests -> Validation #4 Failed -> Pull Request "' + pullRequest.title + '" not merged because the Github Username is not equal to the Message Signed at the User Profile. -> Github Username = ' + githubUsername + '-> messageSigned = ' + messageSigned) - + await sleep(GITHUB_API_WAITING_TIME) await octokit.rest.issues.createComment({ owner: owner, repo: repo, issue_number: pullRequest.number, - body: 'This Pull Request could not be automatically merged by the Superalgos Governance System because it was detected that the Github User " ' + githubUsername + '" who submitted it, is not equal to the Message Signed at the User Profile. messageSigned = "' + messageSigned + '"' - }); + body: 'This Pull Request could not be automatically merged and was closed by the Superalgos Governance System because it was detected that the Github User "' + githubUsername + '" who submitted it, is not equal to the Message Signed at the User Profile. messageSigned = "' + messageSigned + '"' + }); await sleep(GITHUB_API_WAITING_TIME) await octokit.rest.pulls.update({ @@ -1402,8 +1427,8 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE owner: owner, repo: repo, issue_number: pullRequest.number, - body: 'This Pull Request was automatically merged by the Superalgos Governance System because it was detected that the Github User " ' + githubUsername + '" who submitted it, modified its own User Profile Plugin File and nothning else but that file. All validations were successfull.' - }); + body: 'This Pull Request was automatically merged by the Superalgos Governance System because it was detected that the Github User " ' + githubUsername + '" who submitted it, modified its own User Profile Plugin File and nothning else but that file. All validations were successfull.' + }); continue } } diff --git a/Projects/Governance/Plugins/User-Profiles/Luis-Fernando-Molina.json b/Projects/Governance/Plugins/User-Profiles/Luis-Fernando-Molina.json index 53710724b..6a96f898c 100644 --- a/Projects/Governance/Plugins/User-Profiles/Luis-Fernando-Molina.json +++ b/Projects/Governance/Plugins/User-Profiles/Luis-Fernando-Molina.json @@ -137,7 +137,7 @@ "floatingObject": { "isPinned": false, "isFrozen": false, - "isCollapsed": true, + "isCollapsed": false, "angleToParent": 2, "distanceToParent": 3, "arrangementStyle": 0