Improve levitate detect breaking changes pipeline (#94391)

* Update .github/workflows/detect-breaking-changes-levitate.yml

Co-authored-by: Timur Olzhabayev <timur.olzhabayev@grafana.com>

---------

Co-authored-by: Timur Olzhabayev <timur.olzhabayev@grafana.com>
This commit is contained in:
Esteban Beltran 2024-10-08 14:45:54 +02:00 committed by GitHub
parent 02f5e1f930
commit 84554735b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,6 +2,10 @@
--- ---
name: Levitate / Detect breaking changes in PR name: Levitate / Detect breaking changes in PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on: on:
pull_request: pull_request:
paths: paths:
@ -11,7 +15,7 @@ on:
jobs: jobs:
buildPR: buildPR:
name: Build PR name: Build PR packages artifacts
runs-on: ubuntu-latest runs-on: ubuntu-latest
defaults: defaults:
run: run:
@ -27,7 +31,7 @@ jobs:
- name: Get yarn cache directory path - name: Get yarn cache directory path
id: yarn-cache-dir-path id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT run: echo "dir=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
- name: Restore yarn cache - name: Restore yarn cache
uses: actions/cache@v4 uses: actions/cache@v4
@ -57,7 +61,7 @@ jobs:
path: './pr/pr_built_packages.zip' path: './pr/pr_built_packages.zip'
buildBase: buildBase:
name: Build Base name: Build Base packages artifacts
runs-on: ubuntu-latest runs-on: ubuntu-latest
defaults: defaults:
run: run:
@ -75,7 +79,7 @@ jobs:
- name: Get yarn cache directory path - name: Get yarn cache directory path
id: yarn-cache-dir-path id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT run: echo "dir=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
- name: Restore yarn cache - name: Restore yarn cache
uses: actions/cache@v4 uses: actions/cache@v4
@ -105,7 +109,7 @@ jobs:
path: './base/base_built_packages.zip' path: './base/base_built_packages.zip'
Detect: Detect:
name: Detect breaking changes name: Detect breaking changes between PR and base
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: ['buildPR', 'buildBase'] needs: ['buildPR', 'buildBase']
env: env:
@ -179,7 +183,7 @@ jobs:
Report: Report:
name: Report breaking changes in PR name: Report breaking changes in PR comment
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: ['Detect'] needs: ['Detect']
@ -234,9 +238,9 @@ jobs:
echo 'levitate_markdown<<EOF' echo 'levitate_markdown<<EOF'
cat levitate.md cat levitate.md
echo EOF echo EOF
} >> $GITHUB_OUTPUT } >> "$GITHUB_OUTPUT"
else else
echo "levitate_markdown=No breaking changes detected" >> $GITHUB_OUTPUT echo "levitate_markdown=No breaking changes detected" >> "$GITHUB_OUTPUT"
fi fi
@ -253,7 +257,6 @@ jobs:
${{ steps.levitate-markdown.outputs.levitate_markdown }} ${{ steps.levitate-markdown.outputs.levitate_markdown }}
[Read our guideline](https://github.com/grafana/grafana/blob/main/contribute/breaking-changes-guide/breaking-changes-guide.md) [Read our guideline](https://github.com/grafana/grafana/blob/main/contribute/breaking-changes-guide/breaking-changes-guide.md)
[Console output](${{ steps.levitate-run.outputs.job_link }})
* Your pull request merge won't be blocked. * Your pull request merge won't be blocked.
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
@ -359,5 +362,6 @@ jobs:
if [ "${{ steps.levitate-run.outputs.exit_code }}" -ne 0 ]; then if [ "${{ steps.levitate-run.outputs.exit_code }}" -ne 0 ]; then
echo "Breaking changes detected. Please check the levitate report in your pull request. This workflow won't block merging." echo "Breaking changes detected. Please check the levitate report in your pull request. This workflow won't block merging."
fi fi
exit ${{ steps.levitate-run.outputs.exit_code }} exit ${{ steps.levitate-run.outputs.exit_code }}
shell: bash shell: bash