From d5785dc217541428b283c0bb0588fea7f26e72dd Mon Sep 17 00:00:00 2001 From: Shiming Zhang Date: Tue, 24 Dec 2024 16:45:00 +0800 Subject: [PATCH] Add new update list --- .github/workflows/update-allows-list.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/update-allows-list.yml b/.github/workflows/update-allows-list.yml index feaa06c..5c3c060 100644 --- a/.github/workflows/update-allows-list.yml +++ b/.github/workflows/update-allows-list.yml @@ -27,3 +27,18 @@ jobs: - name: Update list run: | curl -v -f --proxy socks5h://127.0.0.1:8080 -X PUT http://crmirror:8080/internal/api/allows -T ./allows.txt + + - name: Update list (new) + run: | + LIST="$(cat ./allows.txt | jq -R -s -c '{"items": split("\n")[:-1]}')" + TOKEN="$(curl -X 'POST' \ + 'https://auth.m.daocloud.io/apis/v1/users/login' \ + -H 'Accept: application/json' \ + -H 'Content-Type: application/json' \ + -d ${{ secrets.USER_LOGIN_DATA }} | jq -r .token)" + curl -f -X 'PUT' \ + 'https://auth.m.daocloud.io/apis/v1/registries/allow_images' \ + -H 'Accept: application/json' \ + -H "Authorization: Bearer ${TOKEN}" \ + -H 'Content-Type: application/json' \ + -d "${LIST}"