From 727a675d4917ac7113cc4ca88b9f050689ef86e9 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Wed, 12 Jun 2024 12:32:53 +0200 Subject: [PATCH] Workflow to generate schema diff (#3649) * Create diff-schema.yml Signed-off-by: 1000TurquoisePogs * Update diff-schema.yml Signed-off-by: 1000TurquoisePogs * Update diff-schema.yml Signed-off-by: 1000TurquoisePogs * Update diff-schema.yml Signed-off-by: 1000TurquoisePogs --------- Signed-off-by: 1000TurquoisePogs Co-authored-by: Mark Ackert <35308966+MarkAckert@users.noreply.github.com> --- .github/workflows/diff-schema.yml | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/diff-schema.yml diff --git a/.github/workflows/diff-schema.yml b/.github/workflows/diff-schema.yml new file mode 100644 index 0000000000..ae8c8c4db7 --- /dev/null +++ b/.github/workflows/diff-schema.yml @@ -0,0 +1,41 @@ +name: Generate schema diff +on: + push: + branches: + - v1.x/master + - v2.x/master + - v3.x/master + + workflow_dispatch: + inputs: + FROM_COMMIT: + description: 'Specify tag (v prefix) to diff from' + required: false + TO_COMMIT: + description: 'Specify tag (v prefix) to diff to' + required: false + +jobs: + diff: + runs-on: ubuntu-latest + steps: + - name: '[Prep 1] Checkout' + uses: actions/checkout@v2 + with: + fetch-depth: '0' + - name: '[Prep 2] Setup Node' + uses: actions/setup-node@v2 + with: + node-version: 18 + - name: '[Prep 3] Get to version' + run: node -e "const fs = require('fs'); const currentVersion = JSON.parse(fs.readFileSync('./manifest.json.template', 'utf8')).version; if ('${{ github.event.inputs.TO_COMMIT }}'.length > 0) { console.log('TO=${{ github.event.inputs.TO_COMMIT }}')} else { console.log('TO=v'+currentVersion) }" >> $GITHUB_ENV + - name: '[Prep 4] Get from version' + run: node -e "if ('${{ github.event.inputs.FROM_COMMIT }}'.length > 0) { console.log('FROM=${{ github.event.inputs.FROM_COMMIT }}') } else { let parts = '${{ env.TO }}'.split('.'); parts[1]--; console.log('FROM='+parts.join('.')); }" >> $GITHUB_ENV + - name: '[Build] Make diff' + run: git diff ${{ env.FROM }} ${{ env.TO }} -- schemas > schemas.diff + - name: '[Upload]' + uses: actions/upload-artifact@v3 + with: + name: schemas.diff + path: schemas.diff + if-no-files-found: error