Skip to content

Commit

Permalink
pr close and group in pr open
Browse files Browse the repository at this point in the history
  • Loading branch information
mishraomp committed Jul 20, 2023
1 parent 0d106e9 commit f40ea90
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/on-pr-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ on:


concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
# PR open and close use the same group, allowing only one at a time
group: pr-${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true

jobs:
builds:
Expand All @@ -34,7 +35,7 @@ jobs:
- uses: bcgov-nr/[email protected]
with:
package: ${{ matrix.package }}
tag: ${{ github.event.number }}
tag: ${{ github.event.number }}, ${{ github.event.pull_request.head.sha }}
tag_fallback: test
token: ${{ secrets.GITHUB_TOKEN }}
build_file: ${{ matrix.build_file }}
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/pr-close.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Pull Request Closed

on:
pull_request:
types:
- closed

concurrency:
# PR open and close use the same group, allowing only one at a time
group: pr-${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true

jobs:
# Clean up OpenShift when PR closed, no conditions
cleanup-openshift:
name: Cleanup OpenShift
runs-on: ubuntu-22.04
steps:
- name: Remove OpenShift artifacts
run: |
oc login --token=${{ secrets.OC_TOKEN }} --server=${{ vars.OC_SERVER }}
oc project ${{ vars.OC_NAMESPACE }}
# Remove old build runs, build pods and deployment pods
helm uninstall nr-oracle-service-${{ github.event.number }}
# If merged into main, then handle any image promotions
image-promotions:
name: Image Promotions
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
runs-on: ubuntu-22.04
permissions:
packages: write
strategy:
matrix:
package: [nr-oracle-service, nr-oracle-service-init]
steps:
- uses: shrink/actions-docker-registry-tag@v3
with:
registry: ghcr.io
repository: ${{ github.repository }}/${{ matrix.package }}
target: ${{ github.event.number }}
tags: test

0 comments on commit f40ea90

Please sign in to comment.