Skip to content

Commit

Permalink
Add code comment
Browse files Browse the repository at this point in the history
  • Loading branch information
roryabraham committed Aug 15, 2024
1 parent 209a0e2 commit 0028718
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ async function run() {
let sameAsInputTag = false;
let wrongEnvironment = false;
let unsuccessfulDeploy = false;

// note: this while statement looks a bit weird because uses assignment as a condition: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while#using_an_assignment_as_a_condition
// while ugly, it's beneficial in this case because it prevents extra network requests from happening unnecessarily (i.e: we only check wrongEnvironment if sameAsInputTag is false, etc...)
while (
(invalidReleaseBranch = !!lastSuccessfulDeploy?.head_branch) &&
((sameAsInputTag = lastSuccessfulDeploy?.head_branch === inputTag) ||
Expand Down
2 changes: 2 additions & 0 deletions .github/actions/javascript/getDeployPullRequestList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11526,6 +11526,8 @@ async function run() {
let sameAsInputTag = false;
let wrongEnvironment = false;
let unsuccessfulDeploy = false;
// note: this while statement looks a bit weird because uses assignment as a condition: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while#using_an_assignment_as_a_condition
// while ugly, it's beneficial in this case because it prevents extra network requests from happening unnecessarily (i.e: we only check wrongEnvironment if sameAsInputTag is false, etc...)
while ((invalidReleaseBranch = !!lastSuccessfulDeploy?.head_branch) &&
((sameAsInputTag = lastSuccessfulDeploy?.head_branch === inputTag) ||
(wrongEnvironment =
Expand Down

0 comments on commit 0028718

Please sign in to comment.