Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: update badge whenever new interop dashboard is ready #86

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/update-badge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Update Badge

on:
workflow_run:
workflows: [Interop Dashboard]
types: [completed]
branches: [master]

defaults:
run:
shell: bash

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
update-badge:
runs-on: ubuntu-latest
steps:
- uses: pl-strflt/job-summary-url-action@v1
with:
workflow: ping-interop-dashboard.yml # ${{ github.event.workflow.path }}
run_id: ${{ github.event.workflow_run.id }}
run_attempt: ${{ github.event.workflow_run.run_attempt }}
job: run-libp2p-test-plans
- uses: actions/checkout@v3
# https://github.com/orgs/community/discussions/26560
- run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
- run: |
in='\[\!\[Interop Dashboard\]\(https\:\/\/github\.com\/libp2p\/test\-plans\/actions\/workflows\/ping\-interop\-dashboard\.yml\/badge\.svg\?branch\=master\)\]\(.*\)'
out="[![Interop Dashboard](https://github.com/libp2p/test-plans/actions/workflows/ping-interop-dashboard.yml/badge.svg?branch=master)](${env.GITHUB_JOB_SUMMARY_URL})"
sed -i '' '#${in}#{out}#' README.md
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we miss things here like using ${{ env.GITHUB ... }} for github substitution, using double quote to allow variable expansion, etc.

I reused your code and updated it with: 55b9be6

- run: |
git diff --exit-code
echo "GIT_CLEAN=$?" >> $GITHUB_OUTPUT
- if: env.GIT_CLEAN == '1'
run: |
git add README.md
git commit -m 'chore: update the link to the interop dashboard [skip ci]'
git push