Skip to content

Commit

Permalink
Merge pull request #272 from HumairAK/fix_pr_action
Browse files Browse the repository at this point in the history
Run PR builds on only code changes...
  • Loading branch information
openshift-merge-robot authored Aug 16, 2023
2 parents 613ce0c + 79ed4fd commit 2eb3262
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/workflows/build-prs-trigger.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Trigger build images for PRs
on:
pull_request:
paths:
- controllers/**
- api/**
- config/**
types:
- opened
- reopened
Expand All @@ -21,6 +25,7 @@ jobs:
echo ${{ github.event.pull_request.number }} >> ./pr/pr_number
echo ${{ github.event.pull_request.state }} >> ./pr/pr_state
echo ${{ github.event.pull_request.head.sha }} >> ./pr/head_sha
echo ${{ github.event.action }} >> ./pr/event_action
- uses: actions/upload-artifact@v2
with:
name: pr
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/build-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
pr_state: ${{ steps.vars.outputs.pr_state }}
pr_number: ${{ steps.vars.outputs.pr_number }}
head_sha: ${{ steps.vars.outputs.head_sha }}
event_action: ${{ steps.vars.outputs.event_action }}
steps:
- name: 'Download artifact'
uses: actions/github-script@v3.1.0
Expand Down Expand Up @@ -50,9 +51,11 @@ jobs:
pr_number=$(cat ./pr_number)
pr_state=$(cat ./pr_state)
head_sha=$(cat ./head_sha)
event_action=$(cat ./event_action)
echo "pr_number=${pr_number}" >> $GITHUB_OUTPUT
echo "pr_state=${pr_state}" >> $GITHUB_OUTPUT
echo "head_sha=${head_sha}" >> $GITHUB_OUTPUT
echo "head_sha=${event_action}" >> event_action
build-pr-image:
if: needs.fetch-data.outputs.pr_state == 'open'
Expand Down Expand Up @@ -82,6 +85,7 @@ jobs:
echo ${{ needs.fetch-data.outputs.head_sha }}
echo ${{ needs.fetch-data.outputs.pr_number }}
echo ${{ needs.fetch-data.outputs.pr_state }}
echo ${{ needs.fetch-data.outputs.event_action }}
- name: Send comment
shell: bash
env:
Expand All @@ -91,7 +95,7 @@ jobs:
git config user.email "${{ env.GH_USER_EMAIL }}"
git config user.name "${{ env.GH_USER_NAME }}"
action=${{ github.event.action }}
action=${{ needs.fetch-data.outputs.event_action }}
if [[ "$action" == "synchronize" ]]; then
echo "Change to PR detected. A new PR build was completed." >> /tmp/body-file.txt
Expand Down

0 comments on commit 2eb3262

Please sign in to comment.