diff --git a/.github/workflows/diff_headers.yml b/.github/workflows/diff_headers.yml new file mode 100644 index 0000000..34743b1 --- /dev/null +++ b/.github/workflows/diff_headers.yml @@ -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/* diff --git a/scripts/diff.sh b/scripts/diff.sh new file mode 100644 index 0000000..d832739 --- /dev/null +++ b/scripts/diff.sh @@ -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 \ No newline at end of file