Plugins: Improve levitate report on forks (#107252)

pull/107778/head
Hugo Kiyodi Oshiro 2 weeks ago committed by GitHub
parent d5a1781fb6
commit 6c1ff32501
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      .github/workflows/detect-breaking-changes-levitate.yml
  2. 4
      scripts/check-breaking-changes.sh
  3. 5
      scripts/levitate-parse-json-report.js

@ -158,6 +158,7 @@ jobs:
- id: 'auth'
uses: 'google-github-actions/auth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f'
if: github.event.pull_request.head.repo.full_name == github.repository
with:
workload_identity_provider: projects/304398677251/locations/global/workloadIdentityPools/github/providers/github-provider
service_account: github-plugins-data-levitate@grafanalabs-workload-identity.iam.gserviceaccount.com
@ -165,6 +166,7 @@ jobs:
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@6189d56e4096ee891640bb02ac264be376592d6a'
if: github.event.pull_request.head.repo.full_name == github.repository
with:
version: '>= 363.0.0'
project_id: 'grafanalabs-global'
@ -175,6 +177,7 @@ jobs:
run: ./scripts/check-breaking-changes.sh
env:
FORCE_COLOR: 3
IS_FORK: ${{ github.event.pull_request.head.repo.full_name != github.repository }} # used in check-breaking-changes.sh and levitate-parse-json-report.js
- name: Persisting the check output
run: |
@ -199,6 +202,7 @@ jobs:
permissions:
contents: read
id-token: write
if: github.event.pull_request.head.repo.full_name == github.repository
steps:
- id: get-secrets

@ -67,5 +67,9 @@ echo "message=$GITHUB_MESSAGE" >>"$GITHUB_OUTPUT"
mkdir -p ./levitate
echo "$GITHUB_LEVITATE_MARKDOWN" >./levitate/levitate.md
if [[ "$IS_FORK" == "true" ]]; then
cat ./levitate/levitate.md
fi
# We will exit the workflow accordingly at another step
exit 0

@ -4,6 +4,8 @@ const printAffectedPluginsSection = require('./levitate-show-affected-plugins');
const data = JSON.parse(fs.readFileSync('data.json', 'utf8'));
const isFork = Boolean(process.env.IS_FORK || false);
function stripAnsi(str) {
return str.replace(/\x1b\[[0-9;]*m/g, '');
}
@ -30,7 +32,8 @@ if (data.changes.length > 0) {
markdown += printSection('Changes', data.changes);
}
if (data.removals.length > 0 || data.changes.length > 0) {
// The logic below would need access to secrets for accessing BigQuery, however that's not available on forks.
if ((data.removals.length > 0 || data.changes.length > 0) && !isFork) {
markdown += printAffectedPluginsSection(data);
}

Loading…
Cancel
Save