| 1 |
# Copyright 2023 The Archivista Contributors |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
# you may not use this file except in compliance with the License. |
| 5 |
# You may obtain a copy of the License at |
| 6 |
# |
| 7 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
# |
| 9 |
# Unless required by applicable law or agreed to in writing, software |
| 10 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
# See the License for the specific language governing permissions and |
| 13 |
# limitations under the License. |
| 14 |
|
| 15 |
on: |
| 16 |
workflow_call: |
| 17 |
inputs: |
| 18 |
pull_request: |
| 19 |
required: true |
| 20 |
type: boolean |
| 21 |
command: |
| 22 |
required: true |
| 23 |
type: string |
| 24 |
step: |
| 25 |
required: true |
| 26 |
type: string |
| 27 |
attestations: |
| 28 |
required: true |
| 29 |
type: string |
| 30 |
|
| 31 |
permissions: |
| 32 |
contents: read |
| 33 |
|
| 34 |
jobs: |
| 35 |
witness: |
| 36 |
runs-on: ubuntu-22.04 |
| 37 |
permissions: |
| 38 |
contents: read |
| 39 |
id-token: write |
| 40 |
steps: |
| 41 |
- name: Harden Runner |
| 42 |
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 |
| 43 |
with: |
| 44 |
egress-policy: audit |
| 45 |
|
| 46 |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 47 |
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 |
| 48 |
with: |
| 49 |
go-version-file: "go.mod" |
| 50 |
|
| 51 |
- if: ${{ inputs.pull_request == false }} |
| 52 |
uses: testifysec/witness-run-action@7aa15e327829f1f2a523365c564c948d5dde69dd |
| 53 |
with: |
| 54 |
witness-install-dir: /opt/witness |
| 55 |
version: 0.9.1 |
| 56 |
step: ${{ inputs.step }} |
| 57 |
attestations: ${{ inputs.attestations }} |
| 58 |
command: /bin/sh -c "${{ inputs.command }}" |
| 59 |
|
| 60 |
- if: ${{ inputs.pull_request == true }} |
| 61 |
run: ${{ inputs.command }} |
| 62 |
|
| 63 |
- if: ${{ inputs.step == 'tests' }} |
| 64 |
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 |