Files
vuln-almalinux/.gitea/workflows/update.yml
T

58 lines
1.8 KiB
YAML

name: AlmaLinux mirror
on:
workflow_dispatch:
schedule:
- cron: "37 */6 * * *"
permissions:
contents: write
concurrency:
group: vuln-almalinux-mirror
cancel-in-progress: false
jobs:
mirror:
runs-on: vulnerability
timeout-minutes: 180
env:
CACHE_ROOT: /vuln-cache/vuln-almalinux
REPO_URL: https://git.apex-project.de/VULN/vuln-almalinux.git
REPO_NAME: vuln-almalinux
GITEA_JOB_TOKEN: ${{ secrets.GITEA_TOKEN }}
steps:
- name: Prepare job dependencies
shell: sh
run: |
set -eu
if command -v apk >/dev/null 2>&1; then
apk add --no-cache bash git python3 util-linux ca-certificates coreutils
elif command -v apt-get >/dev/null 2>&1; then
apt-get update
apt-get install -y --no-install-recommends bash git python3 util-linux ca-certificates coreutils
else
echo 'No supported package manager' >&2
exit 1
fi
/usr/bin/flock --version
- name: Mirror using persistent checkout
shell: bash
run: |
set -Eeuo pipefail
mkdir -p "$CACHE_ROOT"
: "${GITEA_JOB_TOKEN:?GITEA_TOKEN fehlt}"
export GIT_CONFIG_COUNT=1
export GIT_CONFIG_KEY_0=http.extraHeader
export GIT_CONFIG_VALUE_0="Authorization: Basic $(printf 'oauth2:%s' "$GITEA_JOB_TOKEN" | base64 | tr -d '\n')"
if [ ! -d "$CACHE_ROOT/repo/.git" ]; then
git clone --depth 1 --branch main "$REPO_URL" "$CACHE_ROOT/repo"
fi
# run-cached.sh owns the only flock lock
bash "$CACHE_ROOT/repo/scripts/run-cached.sh"
- name: Cache usage
if: always()
shell: sh
run: |
test ! -d "$CACHE_ROOT" || du -sh "$CACHE_ROOT"