Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NO QA] Added CP checking for deployed PR notfication #3771

Merged
merged 5 commits into from
Jul 1, 2021
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
24 changes: 24 additions & 0 deletions .github/actions/checkDeployBlockers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,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 @@ -463,6 +463,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 @@ -369,6 +369,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 @@ -312,6 +312,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 @@ -315,6 +315,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 @@ -291,6 +293,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