-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
354 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: API Diff Report | ||
|
||
on: [pull_request] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
STAGE_PROGRESS: progress | ||
STAGE_END: end | ||
PR_API_OUTPUT: ci_outputs/pr_branch_api | ||
BASE_API_OUTPUT: ci_outputs/base_branch_api | ||
DIFF_REPORT_OUTPUT: ci_outputs/diff_report | ||
|
||
jobs: | ||
diff_report: | ||
runs-on: macos-latest | ||
|
||
steps: | ||
- name: Checkout PR branch | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Copy diff report tools | ||
run: cp -a scripts/api_diff_report/. ~/api_diff_report | ||
|
||
- id: get_changed_files | ||
name: Get changed file list | ||
run: | | ||
echo "file_list=$(git diff --name-only -r HEAD^1 HEAD | tr '\n' ' ')" >> $GITHUB_OUTPUT | ||
- name: Setup python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.7 | ||
|
||
- name: Install Prerequisites | ||
run: ~/api_diff_report/prerequisite.sh | ||
|
||
- name: Clean Diff Report Comment in PR | ||
run: | | ||
python ~/api_diff_report/pr_commenter.py \ | ||
--stage ${{ env.STAGE_PROGRESS }} \ | ||
--token ${{github.token}} \ | ||
--pr_number ${{github.event.pull_request.number}} \ | ||
--commit $GITHUB_SHA \ | ||
--run_id ${{github.run_id}} | ||
- name: Generate API files for PR branch | ||
run: | | ||
python ~/api_diff_report/api_info.py \ | ||
--file_list ${{ steps.get_changed_files.outputs.file_list }} \ | ||
--output_dir ${{ env.PR_API_OUTPUT }} | ||
- name: Checkout Base branch | ||
run: git checkout HEAD^ | ||
|
||
- name: Generate API files for Base branch | ||
run: | | ||
python ~/api_diff_report/api_info.py \ | ||
--file_list ${{ steps.get_changed_files.outputs.file_list }} \ | ||
--output_dir ${{ env.BASE_API_OUTPUT }} | ||
- name: Generate API Diff Report | ||
run: | | ||
python ~/api_diff_report/api_diff_report.py \ | ||
--pr_branch ${{ env.PR_API_OUTPUT }} \ | ||
--base_branch ${{ env.BASE_API_OUTPUT }} \ | ||
--output_dir ${{ env.DIFF_REPORT_OUTPUT }} | ||
- name: Update Diff Report Comment in PR | ||
run: | | ||
python ~/api_diff_report/pr_commenter.py \ | ||
--stage ${{ env.STAGE_END }} \ | ||
--report ${{ env.DIFF_REPORT_OUTPUT }} \ | ||
--token ${{github.token}} \ | ||
--pr_number ${{github.event.pull_request.number}} \ | ||
--commit $GITHUB_SHA \ | ||
--run_id ${{github.run_id}} | ||
- uses: actions/upload-artifact@v3 | ||
if: ${{ !cancelled() }} | ||
with: | ||
name: api_info_and_report | ||
path: ci_outputs | ||
retention-days: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.