diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index bcabe16..da2e0d2 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,27 +1,29 @@ -name: CI +name: PR Build -on: [pull_request] +on: [ pull_request ] jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Ballerina Build - uses: ballerina-platform/ballerina-action/@2201.1.1 - with: - args: - pack - - name: Ballerina Test - uses: ballerina-platform/ballerina-action/@2201.1.1 - with: - args: - test --test-report --code-coverage --coverage-format=xml - env: - ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY_ID }} - SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS_KEY }} - REGION: ${{ secrets.REGION }} - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set Up Ballerina + uses: ballerina-platform/setup-ballerina@v1.1.0 + with: + version: latest + - name: Ballerina Build + run: bal pack + - name: Set Up Ballerina + uses: ballerina-platform/setup-ballerina@v1.1.0 + with: + version: latest + - name: Ballerina Test + # tests will be skipped if the PR is from a forked repository (as the secrets are not available) + if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} + run: bal test --test-report --code-coverage --coverage-format=xml + env: + ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY_ID }} + SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS_KEY }} + REGION: ${{ secrets.REGION }} + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3