-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (49 loc) · 1.72 KB
/
pr.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: PR build
on:
pull_request:
branches:
- main
env:
QUAY_REGISTRY: quay.io
RH_REGISTRY: registry.redhat.io
defaults:
run:
shell: bash
jobs:
build_pr:
# Build only when the PR comes from a branch in the same repo or forced
if: github.repository == github.event.pull_request.head.repo.full_name || inputs.force_build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to Quay.io
uses: redhat-actions/podman-login@v1
with:
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_TOKEN }}
registry: ${{ env.QUAY_REGISTRY }}
- name: Log in to registry.redhat.io
uses: redhat-actions/podman-login@v1
with:
username: ${{ secrets.RH_REGISTRY_USER }}
password: ${{ secrets.RH_REGISTRY_TOKEN }}
registry: ${{ env.RH_REGISTRY }}
- name: Build All
run: |
env
set -x
URL="${{ github.event.pull_request._links.self.href }}"
echo "URL=$URL"
if curl -s -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ github.token }}" -H "X-GitHub-Api-Version: 2022-11-28" "$URL"|jq -r .body|grep -qi '^Test-Hints:.*force-build=true'; then
FORCE_BUILD=true
else
FORCE_BUILD=false
fi
echo "sha=${{ github.event.pull_request.head.sha }}"
SHA=$(cut -c1-8 <<< ${{ github.event.pull_request.head.sha }})
make version
echo "force_build=${{ github.event.inputs.force_build }}"
make all SHA=${SHA} DATE=pr${{ github.event.number }} FORCE_BUILD=$FORCE_BUILD