forgejo min build env: native checkout and fetch github asset script/actions

This commit is contained in:
Vital A Pi 2026-10-07 12:52:38 +03:00
commit 790ca8c2ce
3 changed files with 128 additions and 0 deletions

39
act/checkout/action.yaml Normal file
View file

@ -0,0 +1,39 @@
# SPDX-FileCopyrightText: 2026 Vital A Pi <code@vp.ag>
# SPDX-License-Identifier: MIT
name: 'Fast minimalist working copy checkout'
description: 'No tags, no history, no Node.js'
inputs:
server_url:
description: 'Forgejo server URL'
required: true
default: ${{ forgejo.server_url }}
repository:
description: 'Repository path (owner/repo)'
required: true
default: ${{ forgejo.repository }}
sha:
description: 'Commit SHA to checkout'
required: true
default: ${{ forgejo.sha }}
token:
description: 'Forgejo token for authentication'
required: true
default: ${{ forgejo.token }}
git_object_format:
required: true
default: sha256
runs:
using: 'composite'
steps:
- name: Run git checkout commands
shell: bash
run: |
shopt -s dotglob
rm -rf *
git init --object-format=${{ inputs.git_object_format }} -b main .
git remote add origin "${{ inputs.server_url }}/${{ inputs.repository }}.git"
export AH="Authorization: Basic $(printf 'x-access-token:${{ inputs.token }}' | base64 | tr -d '\n')"
git --config-env=http.extraheader=AH fetch --depth 1 origin "${{ inputs.sha }}"
git reset --hard FETCH_HEAD

View file

@ -0,0 +1,31 @@
# SPDX-FileCopyrightText: 2026 Vital A Pi <code@vp.ag>
# SPDX-License-Identifier: MIT
name: 'GitHub asset downloader'
description: 'Downloads the file and chacks its SHA-sum.'
inputs:
repo:
description: 'The GitHub repository slug (e.g., canonical/chisel)'
required: true
tag:
description: 'The release tag (e.g., v1.4.1)'
required: true
asset:
description: 'The exact name of the asset'
required: true
jq_predicate:
description: 'Optional jq predicate filter for complex matching'
required: false
default: ''
runs:
using: 'composite'
steps:
- name: Run git checkout commands
shell: bash
run: |
"${{ github.action_path }}/../../fetch-gh-asset.sh" \
"${{ inputs.repo }}" \
"${{ inputs.tag }}" \
"${{ inputs.asset }}" \
"${{ inputs.jq_predicate }}"