mirror of
https://hub.psychoinformatics.de/actions/setup-gitannex.git
synced 2026-09-10 05:56:04 +00:00
79 lines
2.5 KiB
YAML
79 lines
2.5 KiB
YAML
name: Set up git-annex
|
|
description: Install git-annex, and configure Git(-annex) for accessing private repositories.
|
|
|
|
inputs:
|
|
version:
|
|
required: false
|
|
default: ""
|
|
description: Optional identifier for the git-annex version to install. See https://pypi.org/project/git-annex/#history for available versions.
|
|
git-name:
|
|
required: false
|
|
default: "Workflow runner"
|
|
description: User name used for the Git identity with which git-annex may create commits.
|
|
git-email:
|
|
required: false
|
|
default: ""
|
|
description: User email used for the Git identity with which git-annex may create commits. By default, a surrogate email is generated from the actor identity and the server URL that triggered the workflow.
|
|
enable-private-repo-access:
|
|
required: false
|
|
default: "true"
|
|
description: Cache the action actor/token credential for non-interactive access by git-annex.
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Ensure uv is available
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
|
if command -v uv >/dev/null 2>&1; then
|
|
echo "uv already installed"
|
|
else
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
fi
|
|
|
|
- name: Install git-annex
|
|
shell: bash
|
|
env:
|
|
SGA_VERSION: ${{ inputs.version }}
|
|
run: |
|
|
set -euo pipefail
|
|
if [ -n "${SGA_VERSION}" ]; then
|
|
uv tool install "git-annex==${SGA_VERSION}"
|
|
else
|
|
uv tool install git-annex
|
|
fi
|
|
|
|
- name: Configure Git identity (for git-annex)
|
|
shell: bash
|
|
env:
|
|
SGA_NAME: ${{ inputs.git-name }}
|
|
SGA_EMAIL: ${{ inputs.git-email }}
|
|
run: |
|
|
set -euo pipefail
|
|
git config --global user.name "${SGA_NAME}"
|
|
if [ -n "$SGA_EMAIL" ]; then
|
|
git config --global user.email "${SGA_EMAIL}"
|
|
else
|
|
git config --global user.email "${{ github.actor }}@${GITHUB_SERVER_URL#*://}"
|
|
fi
|
|
|
|
- name: Provision Git(-annex) access token for private repositories
|
|
if: ${{ inputs.enable-private-repo-access == 'true' }}
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
git config --global credential.helper cache
|
|
git credential approve <<EOF
|
|
url=${{ github.server_url }}
|
|
username=${{ github.actor }}
|
|
password=${{ github.token }}
|
|
EOF
|
|
|
|
- name: Verify Git(-annex) setup
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
git --version
|
|
git annex version
|