File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,29 @@ export async function updateGitHubActionsEnvironment(
9999 custom_branch_policies : true ,
100100 } ,
101101 } ) ;
102+ }
103+
104+ for ( let attempt = 0 ; attempt < 4 ; attempt ++ ) {
105+ if ( attempt > 0 ) {
106+ // Wait a bit before retrying
107+ await new Promise ( ( resolve ) => setTimeout ( resolve , 2000 ) ) ;
108+ }
109+
110+ if ( attempt === 3 ) {
111+ return GitHubActionsEnvironmentResult . UNKNOWN_ERROR ;
112+ }
113+
114+ const existingPolicy = (
115+ await github . repos . listDeploymentBranchPolicies ( {
116+ owner : project . repoOwner ,
117+ repo : project . repoName ,
118+ environment_name : CFA_RELEASE_GITHUB_ENVIRONMENT_NAME ,
119+ } )
120+ ) . data . branch_policies . find ( ( p ) => p . name === project . defaultBranch ) ;
121+
122+ if ( existingPolicy ) {
123+ break ;
124+ }
102125
103126 await github . repos . createDeploymentBranchPolicy ( {
104127 owner : project . repoOwner ,
You can’t perform that action at this time.
0 commit comments