cache-git-credential/.forgejo/workflows/smoke-test.yml
Michael Hanke aff07bb814
All checks were successful
Smoke test git-annex setup action / smoke-test (push) Successful in 18s
feat: support an additional timeout parameter
This allows for overiding Git default of 900s for caching a credential.
This is needed for longer-running workflows that require credential us
of a longer time span.
2026-11-24 13:36:50 +01:00

82 lines
2.3 KiB
YAML

name: Smoke test git-annex setup action
on:
push:
pull_request:
workflow_dispatch:
jobs:
smoke-test:
runs-on: debian-latest
steps:
- name: Check out repository
uses: https://code.forgejo.org/actions/checkout@v4
- name: Test global defaults
uses: ./
- name: Verify globally cached default credential
shell: bash
run: |
set -euo pipefail
credential="$(
printf 'url=%s\n\n' "$GITHUB_SERVER_URL" |
git credential fill
)"
username="$(printf '%s\n' "$credential" | sed -n 's/^username=//p')"
password="$(printf '%s\n' "$credential" | sed -n 's/^password=//p')"
test "$username" = "$GITHUB_ACTOR"
test "$password" = "$GITHUB_TOKEN"
- name: Cache globally with custom cache timeout
uses: ./
with:
timeout: 60
- name: Verify custom cache timeout
shell: bash
run: |
set -euo pipefail
test "$(git config --global --get credential.helper)" = "cache --timeout=60"
- name: Create repository for local-scope test
shell: bash
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/credential-test-repo"
git -C "$RUNNER_TEMP/credential-test-repo" init
- name: Test local repository scope and explicit inputs
uses: ./
with:
repo: ${{ runner.temp }}/credential-test-repo
username: smoke-test-user
password: smoke-test-password
url: https://example.invalid
timeout: 60
- name: Verify locally cached credential
shell: bash
env:
TEST_REPO: ${{ runner.temp }}/credential-test-repo
run: |
set -euo pipefail
test "$(git -C "$TEST_REPO" config --local --get credential.helper)" = \
"cache --timeout=60"
credential="$(
printf 'url=https://example.invalid\n\n' |
git -C "$TEST_REPO" credential fill
)"
username="$(printf '%s\n' "$credential" | sed -n 's/^username=//p')"
password="$(printf '%s\n' "$credential" | sed -n 's/^password=//p')"
test "$username" = "smoke-test-user"
test "$password" = "smoke-test-password"