I’m new to CI/CD and GitHub actions my workflow is I have two branches master and develop and build my app features on the develop branch and after complete, I PR to master and merge the app. And when I merge the develop branch with the master branch, GitHub actions run on both branches.
How to run GitHub actions only on the master branch when I push or pull-request to the master branch from the develop branch.
my ci.yml file
name: Build Android on: push: branches: [master] pull_request: branches: [master] jobs: install-and-test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install npm dependencies run: | npm install - name: Run tests run: | npm test # Second Job build-android: needs: install-and-test runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install npm dependencies run: | npm install - name: Make Gradlew Executable run: cd android && chmod +x ./gradlew # Build Command - name: Build Android Release run: | cd android && ./gradlew assembleRelease # Upload to Artifact - name: Upload Artifact uses: actions/upload-artifact@v1 with: name: app-release.apk path: android/app/build/outputs/apk/release/