From e7819734ec0d174e82270865acb51258e2d512cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E9=9C=B2?= <62973206+zl-go@users.noreply.github.com> Date: Mon, 29 May 2023 11:40:19 +0800 Subject: [PATCH] Update logo.yml --- .github/workflows/logo.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/logo.yml b/.github/workflows/logo.yml index 4a167848..82887122 100644 --- a/.github/workflows/logo.yml +++ b/.github/workflows/logo.yml @@ -6,6 +6,34 @@ on: jobs: build: runs-on: ubuntu-latest + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository. + contents: write steps: - uses: actions/checkout@master name: Check out code + + - name: update logo + run: | + files=$(ls appmanage/static/images) + for file in $files;do + app=$(echo ${file%%-*}) + echo $app + entry=$(curl --include \ + --request GET \ + --header 'Authorization: Bearer ${{secrets.CONTENTFUL}}' \ + https://api.contentful.com/spaces/wbgvl9e8pqe2/environments/master/entries?content_type=media\&fields.slug=${app} | tail -n 1) + echo $entry + data=$(echo $entry | jq -r '.items[0].fields.imageurl') + if [[ "$data" == null ]];then + continue + fi + url=$(echo $data | sed 's/en-US/en/' | jq -r '.en') + echo $url + wget -P appmanage/static/images $url + done + + - name: push logo + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: update logo