Skip to content

Commit

Permalink
Reusable witness workflow
Browse files Browse the repository at this point in the history
Signed-off-by: John Kjell <john@testifysec.com>
  • Loading branch information
jkjell committed Jun 18, 2024
1 parent 85ddab8 commit c32241c
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/witness.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Copyright 2023 The Archivista Contributors
#
# Licensed 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.

on:
workflow_call:
inputs:
pull_request:
required: true
type: boolean
artifact-download:
required: false
type: string
artifact-upload-name:
required: false
type: string
artifact-upload-path:
required: false
type: string
pre-command:
required: false
type: string
command:
required: true
type: string
step:
required: true
type: string
attestations:
required: true
type: string

jobs:
witness:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: 1.21.x

- if: ${{ inputs.artifact-download != '' }}
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: ${{ inputs.artifact-download }}
path: /tmp

- if: ${{ inputs.pre-command != '' && inputs.pull_request == false }}
uses: testifysec/witness-run-action@85ddab8b46a86b2905a3b547a1806ab264fbb810 # v0.2.0
with:
version: 0.6.0
step: pre-${{ inputs.step }}
attestations: ${{ inputs.attestations }}
command: /bin/sh -c "${{ inputs.pre-command }}"
- if: ${{ inputs.pre-command != '' && inputs.pull_request == true }}
run: ${{ inputs.pre-command }}

- if: ${{ inputs.pull_request == false }}
uses: testifysec/witness-run-action@85ddab8b46a86b2905a3b547a1806ab264fbb810 # v0.2.0
with:
version: v0.6.0
step: ${{ inputs.step }}
attestations: ${{ inputs.attestations }}
command: /bin/sh -c "${{ inputs.command }}"
- if: ${{ inputs.pull_request == true }}
run: ${{ inputs.command }}

- if: ${{ inputs.artifact-upload-path != '' && inputs.artifact-upload-name != ''}}
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
with:
name: ${{ inputs.artifact-upload-name }}
path: ${{ inputs.artifact-upload-path }}

0 comments on commit c32241c

Please sign in to comment.