From 7aa5623febdbc34614d50565bded57df188ff9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 12 Jul 2022 11:28:22 +0200 Subject: [PATCH] Trigger diff-api workflow only manually or on tags --- .github/workflows/check-public-api.yaml | 33 ++++++++----------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/.github/workflows/check-public-api.yaml b/.github/workflows/check-public-api.yaml index e449d43e142..fe2ff30009a 100644 --- a/.github/workflows/check-public-api.yaml +++ b/.github/workflows/check-public-api.yaml @@ -3,16 +3,11 @@ name: Check public API env: RUST_BACKTRACE: 1 on: - push: - branches: - - 'master' - tags: - # this is _not_ a regex, see: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet - - '[0-9]+.[0-9]+.[0-9]+*' workflow_dispatch: inputs: - diff-api: - description: 'Diff API' + compareMasterWithVersion: + required: false + description: 'Version to compare with (i.e. "1.0.2")' jobs: setup: name: Set up @@ -21,21 +16,12 @@ jobs: VERSION: ${{ steps.setup.outputs.VERSION }} SHOULD_CHECK_API: ${{ steps.setup.outputs.SHOULD_CHECK_API }} steps: - - - name: Set up env vars - id: setup - shell: bash - run: | - VERSION=${GITHUB_REF/refs\/tags\//} - echo ::set-output name=VERSION::${VERSION} - SHOULD_CHECK_API=$(echo $VERSION | grep -c '^[0-9]\+\.[0-9]\+\.[0-9]\+\(-\([a-zA-Z]\+\)\?[0-9]*\)\?$' || true) - echo ::set-output name=SHOULD_CHECK_API::${SHOULD_CHECK_API} - echo $VERSION - echo $SHOULD_CHECK_API - - - uses: actions/checkout@v3 + + - name: Checkout + uses: actions/checkout@v3 with: fetch-depth: 0 + - name: Install latest nightly uses: actions-rs/toolchain@v1 with: @@ -44,10 +30,11 @@ jobs: override: true - name: Generate API change report + shell: bash run: | cargo install cargo-public-api - cargo install ripgrep - LATEST_VERSION=$(cargo search wasmer | rg --only-matching --replace '$1' 'wasmer = "(.*)"') + CARGO_LATEST_VERSION = git tag --list | tail -n 1 + LATEST_VERSION=${INPUT_COMPAREMASTERWITHVERSION:=$CARGO_LATEST_VERSION} cargo public-api --manifest-path=lib/api/Cargo.toml --diff-git-checkouts $LATEST_VERSION master > diff.txt - name: Archive change report