Centralize circleci configurations for multiple github repositories

version: 2.1

jobs:
deploy-config:
docker:
- image: circleci/python
steps:
- checkout
- run:
name: Test
command: |
echo GLOBAL_64=$(base64 -w 0 global-ci.yml) >> $BASH_ENV
while IFS= read -r repo
do
echo BLOB_SHA=$(curl --location --request GET “https://api.github.com/repos/$repo/contents/.circleci/config.yml” --header “Authorization: token ${GH_TOKEN}” --header “Accept: application/vnd.github.v3+json”|jq -r .sha) >> $BASH_ENV
source $BASH_ENV
curl --location --request PUT “https://api.github.com/repos/$repo/contents/.circleci/config.yml” --header “Authorization: token ${GH_TOKEN}” --header “Accept: application/vnd.github.v3+json” --data-raw “{"message":"Global config update", "content":"$GLOBAL_64", "sha":"${BLOB_SHA}"}”
done < “satellites.txt”

workflows:
main:
jobs:
- deploy-config