diff --git a/.github/workflows/PR-content-check.yml b/.github/workflows/PR-content-check.yml new file mode 100644 index 0000000000..eb2c624155 --- /dev/null +++ b/.github/workflows/PR-content-check.yml @@ -0,0 +1,34 @@ +# This workflow will build a Java project with Maven +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven + +name: PR Content Check + +on: + workflow_call: + outputs: + result: + description: "The result of PR content check" + value: ${{ jobs.check-PR-content.outputs.output1 }} + +jobs: + check-PR-content: + name: Check PR Content + + runs-on: ubuntu-latest + + outputs: + output1: ${{ steps.check-content.outputs.result }} + + steps: + - name: Checkout the incoming pull request + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + path: ion-java-new + + - name: Check the content of the last commit + id: check-content + run: | + cd ion-java-new + if [[ $(git log -1 --name-only) == *"src/"* ]]; then echo "result=pass" >> $GITHUB_OUTPUT; else echo "result=fail" >> $GITHUB_OUTPUT; fi diff --git a/.github/workflows/ion-java-performance-regression-detector.yml b/.github/workflows/ion-java-performance-regression-detector.yml index ae6e3b668b..fe19e59f9a 100644 --- a/.github/workflows/ion-java-performance-regression-detector.yml +++ b/.github/workflows/ion-java-performance-regression-detector.yml @@ -6,9 +6,13 @@ name: Ion Java performance regression detector on: [pull_request] jobs: + PR-Content-Check: + uses: amazon-ion/ion-java/.github/workflows/PR-content-check.yml@master + detect-regression: name: Detect Regression - + needs: PR-Content-Check + if: ${{ needs.PR-Content-Check.outputs.result == 'pass' }} runs-on: ubuntu-latest steps: @@ -18,7 +22,7 @@ jobs: java-version: 1.8 - name: Checkout ion-java from the new commit. - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} path: ion-java-new @@ -27,7 +31,7 @@ jobs: run: cd ion-java-new && git submodule init && git submodule update && ./gradlew clean publishToMavenLocal - name: Checkout ion-java-benchmark-cli - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: amazon-ion/ion-java-benchmark-cli ref: master @@ -70,7 +74,7 @@ jobs: run : rm -r /home/runner/.m2 - name: Checkout the current commit - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: amazon-ion/ion-java ref: master diff --git a/.github/workflows/ion-test-driver.yml b/.github/workflows/ion-test-driver.yml index c7b166b8e0..8c899374f2 100644 --- a/.github/workflows/ion-test-driver.yml +++ b/.github/workflows/ion-test-driver.yml @@ -3,8 +3,13 @@ name: ion-test-driver on: [pull_request] jobs: + PR-Content-Check: + uses: amazon-ion/ion-java/.github/workflows/PR-content-check.yml@master + ion-test-driver: runs-on: macos-10.15 + needs: PR-Content-Check + if: ${{ needs.PR-Content-Check.outputs.result == 'pass' }} steps: - name: Checkout ion-java uses: actions/checkout@master