Loop Multiple AWS Acccounts in GH Actions

In my GH reoo, I have a JSON file with multiple AWS accounts. In my GH Action, I want to loop through each account so that I can perform AWS Login, ECR Login etc for each account before continuing with the other steps. For each account, the Secret Key ID and the Secret Key are stored as Org level secrets. But since there is no way to dynamically fetch each of these secrets based on the AWS Account ID, I am stuck. One alternative is to use strategy matrix. However I am not sure how to build this dynamically. Can anyone please help me?

This isn’t something I’ve tried myself, but the documentation for fromJSON() has an example. The example uses two jobs: The first job puts the JSON data (string!) into an output, the second job runs that output through fromJSON() and assigns the result to the matrix. I hope that helps!