diff --git a/.github/workflows/apply_outside_tool.yml b/.github/workflows/apply_outside_tool.yml new file mode 100644 index 0000000..9d1e321 --- /dev/null +++ b/.github/workflows/apply_outside_tool.yml @@ -0,0 +1,46 @@ +name: test_coverage_with_external_tool + +on: + pull_request: + # open will be triggered when a pull request is created. + # synchronize will be triggered when a pull request has new commits. + # closed will be triggered when a pull request is closed. + types: [opened, synchronize, closed] + +jobs: + setup: + outputs: + base_commit: ${{ steps.get_base_commit.outputs.base_commit }} + runs-on: macOS-latest + steps: + - name: Checkout tools + uses: actions/checkout@v2 + with: + repository: "firebase/firebase-ios-sdk" + path: "tool" + - name: Build tool + run: | + cd tool/scripts/code_coverage_report/generate_code_coverage_report + swift build + + - name: Checkout + uses: actions/checkout@v2 + with: + path: "main" + fetch-depth: 0 + + - name: Get Diff + id: get_base_commit + env: + pr_branch: ${{ github.event.pull_request.head.ref }} + run: | + ls + cd main + git branch -la + common_commit=$(git merge-base remotes/origin/${pr_branch} remotes/origin/main) + echo "The common commit is ${common_commit}." + # Set base commit and this will be used to compare diffs of coverage to the current commit. + echo "::set-output name=base_commit::${common_commit}" + git diff --name-only $common_commit remotes/origin/${pr_branch} > updated_files.txt + cat updated_files.txt + ../tool/scripts/code_coverage_report/generate_code_coverage_report/.build/debug/CoverageReportGenerator diff --git a/post_coverage/test.rb b/post_coverage/test.rb new file mode 100755 index 0000000..ff62474 --- /dev/null +++ b/post_coverage/test.rb @@ -0,0 +1,6 @@ +require 'octokit' + +client = Octokit::Client.new(access_token: ENV["INPUT_ACCESS_TOKEN"]) +#client.add_comment(REPO_NAME_WITH_OWNER, last_issue.number, NO_WORKFLOW_RUNNING_INFO) +client.create_pull_request_comment("granluo/issue_generations",98,"testing","e35ac3de3cf8c0f5ec95736cd7566a1f144afe18","post_coverage/test.rb",4, {:side=>"RIGHT", :start_line=> 3, :line=> 5}) +print ("asdf")