Skip to content

Commit

Permalink
Provide better experience for forked PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarmet committed Jul 22, 2024
1 parent 137f4a6 commit 60f73a6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@ permissions:
contents: read

jobs:
setup:
if: github.event_name == 'pull_request'
outputs:
is_fork: ${{ steps.fork.outputs.is_fork }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Identify if the PR comes from a fork
id: fork
run: echo "is_fork=$(gh pr view --json isCrossRepository --jq .isCrossRepository)" >> $GITHUB_OUTPUT
docker-build:
needs: setup
permissions:
contents: read
packages: write
Expand All @@ -21,3 +32,4 @@ jobs:
name: runner-manager
namespace: ${{ github.repository_owner }}
tag: ${{ github.ref_name == 'main' && 'latest' || github.sha }}
push: ${{ needs.setup.outputs.is_fork == 'true' && false || true }}
24 changes: 13 additions & 11 deletions .github/workflows/test-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,26 @@ permissions:
packages: write

jobs:
docker-build:
permissions:
contents: write
packages: write
uses: scality/workflows/.github/workflows/docker-build.yaml@v2
with:
name: runner-manager
namespace: ${{ github.repository_owner }}

test-deployment:
needs: docker-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build runner-manager image
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
cache-from: type=gha,scope=runner-manager
cache-to: type=gha,mode=max,scope=runner-manager
- uses: helm/kind-action@v1
- name: Load image to kind cluster
run: kind load docker-image ghcr.io/${{ github.repository }}${{ github.sha }}
- name: Edit the runner-manager image
working-directory: manifests
run: kustomize edit set image ghcr.io/${{ github.repository_owner }}/runner-manager:${{ github.sha }}
run: kustomize edit set image ghcr.io/${{ github.repository }}:${{ github.sha }}
- name: Deploy runner-manager
run: kubectl apply -k manifests
- name: Check if deployment is ready
Expand Down

0 comments on commit 60f73a6

Please sign in to comment.