Skip to content

Commit

Permalink
Merge pull request #3771 from parasharrajat/gh-actions
Browse files Browse the repository at this point in the history
[NO QA] Added CP checking for deployed PR notfication
  • Loading branch information
roryabraham authored Jul 1, 2021
2 parents 78238db + f57d2ac commit 8e0c6f5
Show file tree
Hide file tree
Showing 15 changed files with 6,285 additions and 192 deletions.
24 changes: 24 additions & 0 deletions .github/actions/checkDeployBlockers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,30 @@ class GithubUtils {
));
}

/**
* Fetch all pull requests given a list of PR numbers.
*
* @param {Array<Number>} pullRequestNumbers
* @returns {Promise}
*/
static fetchAllPullRequests(pullRequestNumbers) {
const oldestPR = _.first(_.sortBy(pullRequestNumbers));
return this.octokit.paginate(this.octokit.pulls.list, {
owner: GITHUB_OWNER,
repo: EXPENSIFY_CASH_REPO,
state: 'all',
sort: 'created',
direction: 'desc',
per_page: 100,
}, ({data}, done) => {
if (_.find(data, pr => pr.number === oldestPR)) {
done();
}
return data;
})
.then(prList => _.filter(prList, pr => _.contains(pullRequestNumbers, pr.number)));
}

/**
* Create comment on pull request
*
Expand Down
24 changes: 24 additions & 0 deletions .github/actions/createOrUpdateStagingDeploy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,30 @@ class GithubUtils {
));
}

/**
* Fetch all pull requests given a list of PR numbers.
*
* @param {Array<Number>} pullRequestNumbers
* @returns {Promise}
*/
static fetchAllPullRequests(pullRequestNumbers) {
const oldestPR = _.first(_.sortBy(pullRequestNumbers));
return this.octokit.paginate(this.octokit.pulls.list, {
owner: GITHUB_OWNER,
repo: EXPENSIFY_CASH_REPO,
state: 'all',
sort: 'created',
direction: 'desc',
per_page: 100,
}, ({data}, done) => {
if (_.find(data, pr => pr.number === oldestPR)) {
done();
}
return data;
})
.then(prList => _.filter(prList, pr => _.contains(pullRequestNumbers, pr.number)));
}

/**
* Create comment on pull request
*
Expand Down
24 changes: 24 additions & 0 deletions .github/actions/getMergeCommitForPullRequest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,30 @@ class GithubUtils {
));
}

/**
* Fetch all pull requests given a list of PR numbers.
*
* @param {Array<Number>} pullRequestNumbers
* @returns {Promise}
*/
static fetchAllPullRequests(pullRequestNumbers) {
const oldestPR = _.first(_.sortBy(pullRequestNumbers));
return this.octokit.paginate(this.octokit.pulls.list, {
owner: GITHUB_OWNER,
repo: EXPENSIFY_CASH_REPO,
state: 'all',
sort: 'created',
direction: 'desc',
per_page: 100,
}, ({data}, done) => {
if (_.find(data, pr => pr.number === oldestPR)) {
done();
}
return data;
})
.then(prList => _.filter(prList, pr => _.contains(pullRequestNumbers, pr.number)));
}

/**
* Create comment on pull request
*
Expand Down
24 changes: 24 additions & 0 deletions .github/actions/getReleaseBody/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,30 @@ class GithubUtils {
));
}

/**
* Fetch all pull requests given a list of PR numbers.
*
* @param {Array<Number>} pullRequestNumbers
* @returns {Promise}
*/
static fetchAllPullRequests(pullRequestNumbers) {
const oldestPR = _.first(_.sortBy(pullRequestNumbers));
return this.octokit.paginate(this.octokit.pulls.list, {
owner: GITHUB_OWNER,
repo: EXPENSIFY_CASH_REPO,
state: 'all',
sort: 'created',
direction: 'desc',
per_page: 100,
}, ({data}, done) => {
if (_.find(data, pr => pr.number === oldestPR)) {
done();
}
return data;
})
.then(prList => _.filter(prList, pr => _.contains(pullRequestNumbers, pr.number)));
}

/**
* Create comment on pull request
*
Expand Down
24 changes: 24 additions & 0 deletions .github/actions/isPullRequestMergeable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,30 @@ class GithubUtils {
));
}

/**
* Fetch all pull requests given a list of PR numbers.
*
* @param {Array<Number>} pullRequestNumbers
* @returns {Promise}
*/
static fetchAllPullRequests(pullRequestNumbers) {
const oldestPR = _.first(_.sortBy(pullRequestNumbers));
return this.octokit.paginate(this.octokit.pulls.list, {
owner: GITHUB_OWNER,
repo: EXPENSIFY_CASH_REPO,
state: 'all',
sort: 'created',
direction: 'desc',
per_page: 100,
}, ({data}, done) => {
if (_.find(data, pr => pr.number === oldestPR)) {
done();
}
return data;
})
.then(prList => _.filter(prList, pr => _.contains(pullRequestNumbers, pr.number)));
}

/**
* Create comment on pull request
*
Expand Down
2 changes: 2 additions & 0 deletions .github/actions/isStagingDeployLocked/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ inputs:
outputs:
IS_LOCKED:
description: Whether or not the open StagingDeployCash issue is locked.
NUMBER:
description: StagingDeployCash issue number
runs:
using: 'node12'
main: 'index.js'
28 changes: 27 additions & 1 deletion .github/actions/isStagingDeployLocked/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ const GithubUtils = __nccwpck_require__(7999);

const run = function () {
return GithubUtils.getStagingDeployCash()
.then(({labels}) => {
.then(({labels, number}) => {
console.log(`Found StagingDeployCash with labels: ${_.pluck(labels, 'name')}`);
core.setOutput('IS_LOCKED', _.contains(_.pluck(labels, 'name'), '🔐 LockCashDeploys 🔐'));
core.setOutput('NUMBER', number);
})
.catch((err) => {
console.warn('No open StagingDeployCash found, continuing...', err);
core.setOutput('IS_LOCKED', false);
core.setOutput('NUMBER', 0);
});
};

Expand Down Expand Up @@ -300,6 +302,30 @@ class GithubUtils {
));
}

/**
* Fetch all pull requests given a list of PR numbers.
*
* @param {Array<Number>} pullRequestNumbers
* @returns {Promise}
*/
static fetchAllPullRequests(pullRequestNumbers) {
const oldestPR = _.first(_.sortBy(pullRequestNumbers));
return this.octokit.paginate(this.octokit.pulls.list, {
owner: GITHUB_OWNER,
repo: EXPENSIFY_CASH_REPO,
state: 'all',
sort: 'created',
direction: 'desc',
per_page: 100,
}, ({data}, done) => {
if (_.find(data, pr => pr.number === oldestPR)) {
done();
}
return data;
})
.then(prList => _.filter(prList, pr => _.contains(pullRequestNumbers, pr.number)));
}

/**
* Create comment on pull request
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ const GithubUtils = require('../../libs/GithubUtils');

const run = function () {
return GithubUtils.getStagingDeployCash()
.then(({labels}) => {
.then(({labels, number}) => {
console.log(`Found StagingDeployCash with labels: ${_.pluck(labels, 'name')}`);
core.setOutput('IS_LOCKED', _.contains(_.pluck(labels, 'name'), '🔐 LockCashDeploys 🔐'));
core.setOutput('NUMBER', number);
})
.catch((err) => {
console.warn('No open StagingDeployCash found, continuing...', err);
core.setOutput('IS_LOCKED', false);
core.setOutput('NUMBER', 0);
});
};

Expand Down
7 changes: 3 additions & 4 deletions .github/actions/markPullRequestsAsDeployed/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ inputs:
description: "Check if deploying to production"
required: false
default: "false"
IS_CHERRY_PICK:
description: "Did this deploy happen as part of a cherry-pick?"
required: false
default: "false"
STAGING_DEPLOY_NUMBER:
description: "StagingDeployCash issue number"
required: true
DEPLOY_VERSION:
description: "The app version in which the pull requests were deployed"
required: true
Expand Down
Loading

0 comments on commit 8e0c6f5

Please sign in to comment.