Skip to content

Checkout base branch instead of PR head in build workflow #85

Checkout base branch instead of PR head in build workflow

Checkout base branch instead of PR head in build workflow #85

Workflow file for this run

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: Build cmk binaries on PR
on:
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
build:
permissions:
contents: read
runs-on: ubuntu-24.04
env:
GITHUB_TOKEN: ""
outputs:
outcome: ${{ steps.meta.outputs.outcome }}
artifact_url: ${{ steps.meta.outputs.artifact_url }}
steps:
- name: Checkout PR code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Build dist
id: build
run: make dist
continue-on-error: true
- name: Upload zipped dist artifact
id: upload_artifact
if: ${{ steps.build.outcome == 'success' }} # gate on build outcome
uses: actions/upload-artifact@v4
with:
name: cmk-binaries.pr${{ github.event.pull_request.number }}
path: dist/
if-no-files-found: error
retention-days: 10
- name: Expose build outcome & artifact link
id: meta
if: always()
run: |
echo "outcome=${{ steps.build.outcome }}" >> $GITHUB_OUTPUT
echo "artifact_url=${{ steps.upload_artifact.outputs.artifact-url }}" >> $GITHUB_OUTPUT