@elumixor/devkit 0.12.8 → 0.12.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cloud/reconcile/iam.ts +11 -4
package/package.json
CHANGED
|
@@ -266,7 +266,13 @@ export async function deployPolicy(): Promise<PolicyDocument> {
|
|
|
266
266
|
};
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
/**
|
|
269
|
+
/** elumixor's GitHub account id, which repos made since GitHub's immutable OIDC subjects name instead of a path. */
|
|
270
|
+
const GITHUB_OWNER_ID = 12294750;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* The role GitHub Actions assumes: only `elumixor/*` repos, only on the branches that deploy. Older repos send
|
|
274
|
+
* `repo:elumixor/<repo>:…`, newer ones `repo:elumixor@<owner id>/<repo>@<repo id>:…`.
|
|
275
|
+
*/
|
|
270
276
|
export async function ensureDeployRole(branches: readonly string[]) {
|
|
271
277
|
const account = await accountId();
|
|
272
278
|
const policyArn = await ensureManagedPolicy(platform.deployPolicy, await deployPolicy());
|
|
@@ -282,9 +288,10 @@ export async function ensureDeployRole(branches: readonly string[]) {
|
|
|
282
288
|
Condition: {
|
|
283
289
|
StringEquals: { "token.actions.githubusercontent.com:aud": "sts.amazonaws.com" },
|
|
284
290
|
StringLike: {
|
|
285
|
-
"token.actions.githubusercontent.com:sub": branches.
|
|
286
|
-
|
|
287
|
-
|
|
291
|
+
"token.actions.githubusercontent.com:sub": branches.flatMap((branch) => [
|
|
292
|
+
`repo:elumixor/*:ref:refs/heads/${branch}`,
|
|
293
|
+
`repo:elumixor@${GITHUB_OWNER_ID}/*:ref:refs/heads/${branch}`,
|
|
294
|
+
]),
|
|
288
295
|
},
|
|
289
296
|
},
|
|
290
297
|
},
|