diff --git a/.github/workflows/dorothy-workflow.yml b/.github/workflows/dorothy-workflow.yml index 8d332bbb0..7c10dcecc 100644 --- a/.github/workflows/dorothy-workflow.yml +++ b/.github/workflows/dorothy-workflow.yml @@ -1,4 +1,5 @@ # don't use [shell: bash] unless needed, as for macos-fresh that caused an infinite queue for the test step, and for linux bash may not exist yet +# https://docs.github.com/en/actions/learn-github-actions/contexts#github-context name: dorothy-workflow 'on': - push @@ -15,7 +16,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting run: | # ensure dorothy is cloned, and run command - bash -c "$(curl -fsSL 'https://dorothy.bevry.me/install?branch=${{ github.ref_name }}&commit=${{ github.sha }}')" + bash -c "$(curl -fsSL 'https://dorothy.bevry.me/install?slug=${{ github.repository }}&branch=${{ github.ref }}&commit=${{ github.sha }}')" - name: 'Dorothy Configure' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting @@ -103,7 +104,7 @@ jobs: git config --global user.email 'bot@bevry.me' git remote set-url origin 'https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}' git commit -a -m 'ci: adjustments' - git push origin HEAD:${{ github.ref_name }} + git push origin HEAD:${{ github.ref }} fi - name: 'Trunk Check' shell: bash -leo pipefail {0} @@ -116,7 +117,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting run: | # ensure dorothy is cloned, and run command - bash -c "$(curl -fsSL 'https://dorothy.bevry.me/run?branch=${{ github.ref_name }}&commit=${{ github.sha }}')" -- dorothy test + bash -c "$(curl -fsSL 'https://dorothy.bevry.me/run?slug=${{ github.repository }}&branch=${{ github.ref }}&commit=${{ github.sha }}')" -- dorothy test fresh-macos-test: runs-on: macos-latest steps: @@ -129,7 +130,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting run: | # ensure dorothy is cloned, and run command - bash -c "$(curl -fsSL 'https://dorothy.bevry.me/run?branch=${{ github.ref_name }}&commit=${{ github.sha }}')" -- dorothy test + bash -c "$(curl -fsSL 'https://dorothy.bevry.me/run?slug=${{ github.repository }}&branch=${{ github.ref }}&commit=${{ github.sha }}')" -- dorothy test distro-test: continue-on-error: true runs-on: ubuntu-latest diff --git a/commands/dorothy b/commands/dorothy index 3b44bcdce..f0ae78256 100755 --- a/commands/dorothy +++ b/commands/dorothy @@ -25,7 +25,7 @@ function dorothy_() ( # sanity check that we are running in bash # sanity check, as [function .. () (], [elif], [&>], [local] are all bashisms, so other shells should have failed by now if test -z "${BASH_VERSION-}"; then - printf '%s\n' 'Dorothy requires bash to run. Refer to the installation instructions: https://github.com/bevry/dorothy#install' >/dev/stderr + printf '%s\n' "Dorothy requires bash to run. Refer to the installation instructions: $dorothy_install" >/dev/stderr exit 6 # ENXIO 6 Device not configured fi @@ -80,7 +80,8 @@ function dorothy_() ( # Variables # vars that are local to this script and shared between functions - local dorothy_homepage="https://github.com/bevry/dorothy" + local dorothy_homepage='https://github.com/bevry/dorothy' + local dorothy_install="$dorothy_homepage#install" # ===================================== # Arguments @@ -191,7 +192,7 @@ function dorothy_() ( # process action arguments # @todo prevent double-action overwrite - local item action='' option_xdg='' option_branch='' option_commit='' option_reference='HEAD' option_args=() + local item action='' option_xdg='' option_branch='' option_commit='' option_reference='HEAD' option_slug='bevry/dorothy' option_args=() while test "$#" -ne 0; do item="$1" shift @@ -207,7 +208,8 @@ function dorothy_() ( option_commit="${item#*=}" option_reference="$option_commit" ;; - '--reference='*) option_reference="${item#*=}" ;; + '--ref='* | '--reference='*) option_reference="${item#*=}" ;; + '--slug='*) option_slug="${item#*=}" ;; 'repl') action='repl' option_args+=("$@") @@ -279,7 +281,7 @@ function dorothy_() ( if test -n "$DOROTHY" -a -f "$DOROTHY/sources/bash.bash"; then source "$DOROTHY/sources/bash.bash" else - eval "$(curl -fsSL "https://raw.githubusercontent.com/bevry/dorothy/$option_reference/sources/bash.bash")" + eval "$(curl -fsSL "https://raw.githubusercontent.com/$option_slug/$option_commit/sources/bash.bash")" fi # ===================================== @@ -391,7 +393,7 @@ function dorothy_() ( fish -c 'builtin realpath "$argv[1]"' -- "$path" return else - __print_line 'Dorothy requires readlink or realpath to be installed. https://github.com/bevry/dorothy#install' >/dev/stderr + __print_line "Dorothy requires readlink or realpath to be installed. $dorothy_install" >/dev/stderr return 6 # ENXIO 6 Device not configured fi done @@ -480,7 +482,7 @@ function dorothy_() ( ps: $(type -P ps || :) awk: $(awk --version || :) - Refer to the manual: https://github.com/bevry/dorothy + Refer to the manual: $dorothy_homepage EOF return 19 # ENODEV 19 Operation not supported by device fi @@ -839,14 +841,14 @@ function dorothy_() ( function install_dorothy { print_line "Installing Dorothy into $DOROTHY" if test -n "$option_branch"; then - git clone --branch "$option_branch" --single-branch "https://github.com/bevry/dorothy.git" "$DOROTHY" + git clone --branch "$option_branch" --single-branch "https://github.com/$option_slug.git" "$DOROTHY" else - git clone "https://github.com/bevry/dorothy.git" "$DOROTHY" + git clone "https://github.com/$option_slug.git" "$DOROTHY" fi - if test -n "$option_commit"; then + if test -n "$option_reference"; then ( cd "$DOROTHY" - git checkout "$option_commit" + git checkout "$option_reference" ) fi } @@ -1067,7 +1069,7 @@ function dorothy_() ( To enable SSH, do the following on this machine: macOS via: System Preferences > Sharing > Remote Login. - Linux via: $(echo-style --code="bash -ic \"\$(curl -fsSL https://dorothy.bevry.workers.dev/commands/setup-util-sshd)\"") + Linux via: $(echo-style --code="bash -ic \"\$(curl -fsSL https://dorothy.bevry.me/run)\" -- setup-util-sshd") EOF )"