Skip to content

Commit

Permalink
Add diff_headers.yml action
Browse files Browse the repository at this point in the history
  • Loading branch information
littleGnAl committed Apr 2, 2024
1 parent 51f0859 commit 83cab46
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/diff_headers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Diff headers

on:
workflow_dispatch:
inputs:
base-version:
description: 'e.g., rtc_4.3.0'
type: 'string'
required: true
target-version:
description: 'e.g., rtc_4.3.1'
type: 'string'
required: true

jobs:
diff-headers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Update headers
run: |
bash scripts/diff.sh ${{ inputs.base-version }} ${{ inputs.target-version }}
shell: bash

- name: Create pull request
uses: AgoraIO-Extensions/actions/.github/actions/pr@main
with:
github-token: ${{ secrets.GH_TOKEN }}
target-repo: ${{ github.workspace }}
target-branch: ${{ github.ref_name }}
target-branch-name-surffix: headers-update
pull-request-title: |
[AUTO] Update native headers
pull-request-body: |
native headers source:
${{ inputs.url }}
add-paths: headers/*
16 changes: 16 additions & 0 deletions scripts/diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -e
set -x

BASE=$1
TARGET=$2

BASE_PATH=headers/${BASE}/include
TARGET_PATH=headers/${TARGET}/include

RESULT=$(diff -u -b -r ${BASE_PATH} ${TARGET_PATH})

SUMMARY="\`\`\`diff\n""${RESULT}""\n\`\`\`"

# Output the github action summary.
echo '${SUMMARY}' >> $GITHUB_STEP_SUMMARY

0 comments on commit 83cab46

Please sign in to comment.