cache-git-credential/.forgejo/workflows/smoke-test.yml

66 lines
1.8 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: 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
- name: Verify locally cached credential
shell: bash
env:
TEST_REPO: ${{ runner.temp }}/credential-test-repo
run: |
set -euo pipefail
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"