From c876f8e101867badc0462e293b0f5d6782788059 Mon Sep 17 00:00:00 2001 From: "Paul B." Date: Tue, 26 Mar 2024 16:06:37 +0100 Subject: [PATCH] WIP: trying to apply an overlay before deploy --- .github/workflows/diff.yml | 7 +++++-- overlays/greenly-tags.yaml | 31 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 overlays/greenly-tags.yaml diff --git a/.github/workflows/diff.yml b/.github/workflows/diff.yml index 951a61c..d9b3f11 100644 --- a/.github/workflows/diff.yml +++ b/.github/workflows/diff.yml @@ -51,13 +51,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + - name: Apply overlay to API document + run: | + npx bump-cli overlay apis/greenly-openapi-source.json overlays/greenly-tags.yaml > apis/greenly-openapi-public.json - name: Comment pull request with API diff uses: bump-sh/github-action@v1 with: doc: greenly token: ${{ secrets.GREENLY_BUMP_TOKEN }} - file: apis/greenly-openapi-source.json + file: apis/greenly-openapi-public.json command: diff env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/overlays/greenly-tags.yaml b/overlays/greenly-tags.yaml new file mode 100644 index 0000000..2b12a6c --- /dev/null +++ b/overlays/greenly-tags.yaml @@ -0,0 +1,31 @@ +overlay: 1.0.0 +info: + title: Add tags and description to Greenly API + version: 0.0.1 +actions: + - target: '$' + description: Add description to grouping tags. + update: + tags: + - name: "alternatives" + description: | + Everything about low-carbon alternatives + - name: "offsetProjects" + description: | + Find some carbon-offset related projects, only if you can't find a lower carbon alternative. + - name: "live" + description: | + Status of the API. + - name: "purchaseCategories" + description: | + Purchase categories is about purchasing. + - name: "transactions" + description: | + Compute the carbon footprint of your transactions. + - name: "users" + description: | + All endpoints to manage your users. + - target: "$..[?(@['tags'] && @['tags'].includes('ready'))]" + description: rename 'ready' tags into 'live' tags + update: + tags: ["live"]