Skip to content

Commit

Permalink
factored out code to reshare with shellcheckit
Browse files Browse the repository at this point in the history
  • Loading branch information
yarikoptic committed Mar 9, 2023
1 parent 3bf848e commit 4410bee
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
18 changes: 1 addition & 17 deletions codespellit
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
#!/bin/bash

set -eu
branch=$(git rev-parse --abbrev-ref HEAD)
ghuser=$(git config github.user)
ghremote=gh-${ghuser:-mine}

if [ -z "${GITHUB_TOKEN:-}" ]; then
# if not available -- load from config possibly
GITHUB_TOKEN=$(git config hub.oauthtoken)
fi

if ! git remote | grep "$ghremote"; then
if ! GH_TOKEN="$GITHUB_TOKEN" gh repo fork --remote --remote-name "$ghremote"; then
echo "errored out, sleeping, trying to fetch"
sleep 2
git fetch "$ghremote"
fi
fi
source $(readlink -f $0 | xargs dirname)/common.sh

git checkout -b enh-codespell

# do workflow first since straightforward
mkdir -p .github/workflows
cat > .github/workflows/codespell.yml << EOF
---
name: Codespell
Expand Down
18 changes: 18 additions & 0 deletions common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
branch=$(git rev-parse --abbrev-ref HEAD)
ghuser=$(git config github.user)
ghremote=gh-${ghuser:-mine}

if [ -z "${GITHUB_TOKEN:-}" ]; then
# if not available -- load from config possibly
GITHUB_TOKEN=$(git config hub.oauthtoken)
fi

if ! git remote | grep "$ghremote"; then
if ! GH_TOKEN="$GITHUB_TOKEN" gh repo fork --remote --remote-name "$ghremote"; then
echo "errored out, sleeping, trying to fetch"
sleep 2
git fetch "$ghremote"
fi
fi
mkdir -p .github/workflows

0 comments on commit 4410bee

Please sign in to comment.