Skip to content

Commit

Permalink
Trigger diff-api workflow only manually or on tags
Browse files Browse the repository at this point in the history
  • Loading branch information
fschutt committed Jul 21, 2022
1 parent 1aaf430 commit c31e052
Showing 1 changed file with 10 additions and 23 deletions.
33 changes: 10 additions & 23 deletions .github/workflows/check-public-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit c31e052

Please sign in to comment.