Skip to content

Commit

Permalink
Added ability to comment on a PR to trigger a build
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksantamaria committed Aug 22, 2024
1 parent 3bce41c commit fff2fa5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ Improvement - Description (#ISSUENUMBER)

# Closing issues
Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes (if such).

# PR Comment Commands

- Commenting `/build` on a pull request will trigger the build & deploy workflow for the current branch.
12 changes: 10 additions & 2 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- closed
- opened
- synchronize
issue_comment:
types:
- created
schedule:
- cron: '23 20 * * 0'
workflow_dispatch:
Expand All @@ -14,7 +17,11 @@ env:
REGISTRY: ghcr.io
jobs:
buildx:
if: github.event.pull_request.merged == true || contains(fromJson('["schedule", "workflow_dispatch"]'), github.event_name) || github.event_name == 'pull_request' && startsWith(github.head_ref,'build/')
if: |-
github.event.pull_request.merged == true ||
contains(fromJson('["schedule", "workflow_dispatch"]'), github.event_name) ||
github.event_name == 'pull_request' && startsWith(github.head_ref,'build/') ||
( github.event.issue.pull_request && contains(github.event.comment.body, '/build') )
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -45,6 +52,7 @@ jobs:
type=ref,event=pr,enable=${{ github.event.pull_request.merged == false }}
type=raw,value=${{ github.event.pull_request.base.ref }},enable=${{ github.event.pull_request.merged == true }}
type=ref,event=branch,enable=${{ contains(fromJson('["schedule", "workflow_dispatch"]'), github.event_name) }}
type=raw,event=default,value=pr-${{ github.event.issue.number }},enable=${{ github.event.issue.pull_request != null }}
labels: |
maintainer=Digital Victoria
repository=${{ github.repositoryUrl }}
Expand Down Expand Up @@ -78,4 +86,4 @@ jobs:
./gh-actions-bake.hcl
${{ steps.meta.outputs.bake-file }}
# Target the default group - probably unnecessary.
targets: ${{ matrix.images }}
targets: ${{ matrix.images }}

0 comments on commit fff2fa5

Please sign in to comment.