Skip to content

Update Store API

Update Store API #54

Workflow file for this run

name: Update Store API
on:
workflow_dispatch:
inputs:
shopware_version:
description: "Shopware version"
required: true
type: string
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
save-file:
name: "Save file"
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- shell: bash
run: |
cp storeapi.json storeapi-original.json
- name: Upload original file
uses: actions/upload-artifact@v3
with:
name: original-file
path: storeapi-original.json
# This workflow contains a single job called "build"
generate-schema:
uses: shopware/docs-ci/.github/workflows/generate_schema.yml@main
with:
schema_flags: --store-api
schema_file: storeapi.json
shopware_version: ${{ inputs.shopware_version }}
secrets: inherit
open-pr:
name: "Open a pull request"
runs-on: ubuntu-latest
needs: [generate-schema]
env:
FILE_DIFFERENCE: 0
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: download api schema
uses: actions/download-artifact@v3
with:
name: ${{needs.generate-schema.outputs.api_schema}}
- name: install yq
uses: cachix/install-nix-action@v18
- name: Add custom descriptions
run: |
for k in $(yq '. | keys | .[]' descriptions.yml); do
newDescription=$(yq ".\"$k\"" descriptions.yml);
# Indent 4; output as json; edit in place
yq -I 4 -o json -i "$k.description = \"${newDescription}\"" storeapi.json
done
- name: Download original file
uses: actions/download-artifact@v3
with:
name: original-file
- name: Prettify
run: |
sudo apt-get update
sudo apt-get install -y moreutils
jq . storeapi.json | sponge storeapi.json
cmp <(sort storeapi.json) <(sort storeapi-original.json) || echo "FILE_DIFFERENCE=1" >> $GITHUB_ENV
rm storeapi-original.json
- name: Create PR
if: ${{ env.FILE_DIFFERENCE == 1 }}
uses: peter-evans/create-pull-request@v4
with:
add-paths: storeapi.json
author: shopwareBot <[email protected]>
committer: shopwareBot <[email protected]>
assignees: sushmangupta, Isengo1989, bojanrajh
branch: "schema-update-${{ env.BRANCH_NAME }}"
delete-branch: true
title: 'Update {{ env.BRANCH_NAME }} store API schema'