qiaofeng1227 преди 2 години
родител
ревизия
bc95ed0e1a

+ 0 - 3
.github/workflows/catalog_query.json

@@ -1,3 +0,0 @@
-{
-  "query": "query($locale: String){catalog(id: \"2Yp0TY3kBHgG6VDjsHZNpK\",locale:$locale) {linkedFrom(allowedLocales:[\"en-US\"]) {catalogCollection(limit:20) {items {key position title linkedFrom(allowedLocales:[\"en-US\"]) {catalogCollection(limit:20) {items {key title position}}}}}}}}"
-}

+ 0 - 72
.github/workflows/getContentfulData.yml

@@ -1,72 +0,0 @@
-name: Get data from contentful
-
-on: workflow_dispatch
-
-jobs:
-  fetch-data:
-    runs-on: ubuntu-latest
-
-    steps:
-      - uses: actions/checkout@v2
-
-      # Define some variables for convenience
-      - name: Set up variables
-        env:
-          ACCESS_TOKEN: ${{ secrets.CONTENTFUL_GRAPHQLTOKEN }}
-          LOCALES: "en-US,zh-CN"
-          LIMIT: 100
-          SPACE_ID: ffrhttfighww
-          API_URL: https://graphql.contentful.com/content/v1/spaces/$SPACE_ID
-        run: |
-          echo "ACCESS_TOKEN=$ACCESS_TOKEN" >> $GITHUB_ENV
-          echo "LOCALES=$LOCALES" >> $GITHUB_ENV
-          echo "LIMIT=$LIMIT" >> $GITHUB_ENV
-          echo "API_URL=$API_URL" >> $GITHUB_ENV
-
-      # Create a file with the query function
-      - name: Create query function file
-        run: |
-          cat > query.sh <<EOF
-          #!/bin/bash
-          query() {
-            FILE=$1
-            LOCALE=$2
-            SKIP=$3
-            jq -n --argfile query $FILE --arg locale $LOCALE --arg skip $SKIP '$query + {variables: {locale: $locale, skip: ($skip|tonumber)}}'
-          }
-          EOF
-
-      # Loop through different queries and locales
-      - name: Fetch data from contentful graphql
-        run: |
-          mkdir -p appmanage/static/json
-          IFS=',' read -ra LOCALE_ARRAY <<< "$LOCALES"
-          for QUERY_FILE in catalog_query.json product_query.json; do
-            for LOCALE in "${LOCALE_ARRAY[@]}"; do
-              # Get the output file name from the query file name and locale
-              OUTPUT_FILE=${QUERY_FILE%_query.json}_$LOCALE.json
-              SKIP=0
-              TOTAL=0
-              while [ $SKIP -le $TOTAL ]; do
-                # Load the query function from the file and generate the query string from the file and variables
-                source query.sh
-                QUERY=$(query $QUERY_FILE $LOCALE $SKIP)
-                # Send the query to the API and get the response
-                RESPONSE=$(curl -X POST \
-                  -H "Content-Type: application/json" \
-                  -H "Authorization: Bearer $ACCESS_TOKEN" \
-                  -d "$QUERY" \
-                  $API_URL)
-                # Append the items to the output file
-                echo $RESPONSE | jq '.data.productCollection.items' >> appmanage/static/json/$OUTPUT_FILE
-                # Update the total and skip values
-                TOTAL=$(echo $RESPONSE | jq '.data.productCollection.total')
-                SKIP=$((SKIP + LIMIT))
-              done
-            done
-          done
-
-      - name: Commit and push changes
-        uses: stefanzweifel/git-auto-commit-action@v4
-        with:
-          commit_message: Update catalog.json and product.json

+ 0 - 53
.github/workflows/getDatafromContentful.yml

@@ -1,53 +0,0 @@
-name: Fetch data from contentful graphql
-
-on: workflow_dispatch
-
-jobs:
-  fetch-data:
-    runs-on: ubuntu-latest
-
-    steps:
-      - uses: actions/checkout@v2
-
-      - name: Fetch data from contentful graphql
-        env:
-          ACCESS_TOKEN: ${{ secrets.CONTENTFUL_GRAPHQLTOKEN }}
-          LOCALES: "en-US,zh-CN"
-        run: |
-          mkdir -p appmanage/static/json
-          IFS=',' read -ra LOCALE_ARRAY <<< "$LOCALES"
-          for LOCALE in "${LOCALE_ARRAY[@]}"; do
-            curl -X POST \
-              -H "Content-Type: application/json" \
-              -H "Authorization: Bearer $ACCESS_TOKEN" \
-              -d '{"query":"query($locale: String){catalog(id: \"2Yp0TY3kBHgG6VDjsHZNpK\",locale:$locale) {linkedFrom(allowedLocales:[\"en-US\"]) {catalogCollection(limit:20) {items {key position title linkedFrom(allowedLocales:[\"en-US\"]) {catalogCollection(limit:20) {items {key title position}}}}}}}}","variables":{"locale":"'$LOCALE'"}}' \
-              https://graphql.contentful.com/content/v1/spaces/ffrhttfighww > appmanage/static/json/catalog_$LOCALE.json
-          done
-
-      - name: Fetch Product data from contentful graphql
-        env:
-          ACCESS_TOKEN: ${{ secrets.CONTENTFUL_GRAPHQLTOKEN }}
-          LOCALES: "en-US,zh-CN"
-          LIMIT: 100
-        run: |
-          mkdir -p appmanage/static/json
-          IFS=',' read -ra LOCALE_ARRAY <<< "$LOCALES"
-          for LOCALE in "${LOCALE_ARRAY[@]}"; do
-            SKIP=0
-            TOTAL=0
-            while [ $SKIP -le $TOTAL ]; do
-              RESPONSE=$(curl -X POST \
-                -H "Content-Type: application/json" \
-                -H "Authorization: Bearer $ACCESS_TOKEN" \
-                -d '{"query":"query($locale: String,$skip: Int){productCollection(locale:$locale,where:{appStore:true},limit: '$LIMIT', skip: $skip) {total items {sys {id} key hot trademark summary overview websiteurl description screenshots distribution vcpu memory storage logo {imageurl} catalogCollection(limit:15) {items {key title catalogCollection(limit:5){items{key title}}}}}}}", "variables":{"locale":"'$LOCALE'", "skip":'$SKIP'}}' \
-                https://graphql.contentful.com/content/v1/spaces/ffrhttfighww)
-              echo $RESPONSE | jq '.data.productCollection.items' >> appmanage/static/json/product_$LOCALE.json
-              TOTAL=$(echo $RESPONSE | jq '.data.productCollection.total')
-              SKIP=$((SKIP + LIMIT))
-            done
-          done
-
-      - name: Commit and push changes
-        uses: stefanzweifel/git-auto-commit-action@v4
-        with:
-          commit_message: Update catalog.json

+ 0 - 3
.github/workflows/product_query.json

@@ -1,3 +0,0 @@
-{
-  "query": "query($locale: String,$skip: Int){productCollection(locale:$locale,where:{appStore:true},limit: $LIMIT, skip: $skip) {total items {sys {id} key hot trademark summary overview websiteurl description screenshots distribution vcpu memory storage logo {imageurl} catalogCollection(limit:15) {items {key title catalogCollection(limit:5){items{key title}}}}}}}"
-}