Skip to content

.github/workflows/e2e.generic.schedule.main.adversarial-invalidsubjects.slsa3.yml #1339

.github/workflows/e2e.generic.schedule.main.adversarial-invalidsubjects.slsa3.yml

.github/workflows/e2e.generic.schedule.main.adversarial-invalidsubjects.slsa3.yml #1339

on:
schedule:
- cron: "0 4 * * *"
workflow_dispatch:
permissions: read-all
concurrency: "e2e.generic.schedule.main.adversarial-invalidsubjects.slsa3"
env:
GH_TOKEN: ${{ secrets.E2E_GENERIC_TOKEN }}
ISSUE_REPOSITORY: slsa-framework/slsa-github-generator
jobs:
build:
outputs:
digests: ${{ steps.hash.outputs.hashes }}
runs-on: ubuntu-latest
steps:
- name: Build artifacts
run: |
# These are some amazing artifacts.
echo "artifact1" > artifact1
echo "artifact2" > artifact2
- name: Upload artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: artifacts
if-no-files-found: error
retention-days: 5
path: |
artifact1
artifact2
- name: Generate hashes
shell: bash
id: hash
run: |
# sha256sum generates sha256 hash for all artifacts.
# base64 -w0 encodes to base64 and outputs on a single line.
# sha256sum artifact1 artifact2 ... | base64 -w0
echo "hashes=$(echo artifact1 somethinginvalid | base64 -w0)" >> "${GITHUB_OUTPUT}"
provenance:
needs: [build]
permissions:
id-token: write # For signing.
contents: write # For asset uploads.
actions: read # For the entrypoint.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@main
with:
base64-subjects: "${{ needs.build.outputs.digests }}"
compile-generator: true
if-failed-build:
runs-on: ubuntu-latest
needs: [build]
# NOTE: The workflow is allowed to run for other event types but don't post
# to issues unless it's a schedule event.
if: always() && github.event_name == 'schedule' && needs.build.result == 'failure'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- run: ./.github/workflows/scripts/e2e-report-failure.sh
if-failed-provenance:
runs-on: ubuntu-latest
needs: [build, provenance]
# NOTE: The workflow is allowed to run for other event types but don't post
# to issues unless it's a schedule event.
if: always() && github.event_name == 'schedule' && needs.build.result == 'success' && needs.provenance.result == 'failure'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- run: ./.github/workflows/scripts/e2e-report-success.sh
if-succeeded-provenance:
runs-on: ubuntu-latest
needs: [build, provenance]
# NOTE: The workflow is allowed to run for other event types but don't post
# to issues unless it's a schedule event.
if: always() && github.event_name == 'schedule' && needs.build.result == 'success' && needs.provenance.result == 'success'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- run: ./.github/workflows/scripts/e2e-report-failure.sh