diff --git a/.github/workflows/01-run-on-push.yaml b/.github/workflows/01-run-on-push.yaml index b21b31e..d5598b2 100644 --- a/.github/workflows/01-run-on-push.yaml +++ b/.github/workflows/01-run-on-push.yaml @@ -2,6 +2,7 @@ name: 01-run-on-push on: push: + branches: [main] jobs: run-on-push: diff --git a/.github/workflows/02-run-after-another.yaml b/.github/workflows/02-run-after-another.yaml index eefe117..12e477e 100644 --- a/.github/workflows/02-run-after-another.yaml +++ b/.github/workflows/02-run-after-another.yaml @@ -2,7 +2,7 @@ name: 02-run-after-another on: workflow_run: - workflows: [01-run-on-push] + workflows: [01-run-on-push, 03-run-on-pull-request] types: [completed] jobs: @@ -24,3 +24,5 @@ jobs: GITHUB_CONTEXT: ${{ toJson(github) }} run: | echo "$GITHUB_CONTEXT" + - name: Test step for PR + run: echo "No op step added just for testing" diff --git a/.github/workflows/03-run-on-pr.yaml b/.github/workflows/03-run-on-pr.yaml new file mode 100644 index 0000000..5fc92ba --- /dev/null +++ b/.github/workflows/03-run-on-pr.yaml @@ -0,0 +1,14 @@ +name: 03-run-on-pull-request + +on: + pull_request: + +jobs: + run-on-pull-request: + runs-on: ubuntu-latest + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: | + echo "$GITHUB_CONTEXT" diff --git a/README.md b/README.md index c52e582..6119913 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ Various proofs of concept examples using Github Actions 🤖 | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- | | [![01-run-on-push](https://github.com/mbtamuli/github-actions-pocs/actions/workflows/01-run-on-push.yaml/badge.svg)](https://github.com/mbtamuli/github-actions-pocs/actions/workflows/01-run-on-push.yaml) | Runs on push event to any branch. | | [![02-run-after-another](https://github.com/mbtamuli/github-actions-pocs/actions/workflows/02-run-after-another.yaml/badge.svg)](https://github.com/mbtamuli/github-actions-pocs/actions/workflows/02-run-after-another.yaml) | Run after another workflow, in this case after [01-run-on-push](https://github.com/mbtamuli/github-actions-pocs/actions/workflows/01-run-on-push.yaml) | +| [![03-run-on-pull-request](https://github.com/mbtamuli/github-actions-pocs/actions/workflows/03-run-on-pull-request.yaml/badge.svg)](https://github.com/mbtamuli/github-actions-pocs/actions/workflows/03-run-on-pull-request.yaml) | Runs on pull request event for any branch. | ## Reference