tespkg / actions-cache

Cache to S3 storage with official actions/cache@v2 fallback
MIT License
75 stars 31 forks source link

Addin optional session token to inputs #12

Closed endriu0 closed 2 years ago

endriu0 commented 2 years ago

This allows using the action with iam role / tested this with IAM role in our environment and it worked.

Disclaimer: Not a developer so if something else needs to be done to get this working correctly let me know.

Changes

jackieli-tes commented 2 years ago

thanks for the contribution. It looks like you didn't commit the full source? I only see it getting retrieved in utils.ts, but where is the session token used?

endriu0 commented 2 years ago

So tbh that's all that was needed for this to work. With my limited node knowledge I assumed all that's needed is to update this function

https://github.com/tespkg/actions-cache/blob/7772cfd03ff3ed958a72c0f34934da869254367a/src/utils.ts#L15

and then it gets used automatically below :

https://github.com/tespkg/actions-cache/blob/7772cfd03ff3ed958a72c0f34934da869254367a/src/utils.ts#L76-L77 https://github.com/tespkg/actions-cache/blob/7772cfd03ff3ed958a72c0f34934da869254367a/src/utils.ts#L102-L103

Since the session token is part of the credentials and is returned from assume-role in aws / needs to be passed together with access-key / secret-key.

jackieli-tes commented 2 years ago

you're right, my mistake. running pipeline.