From 53b331d61b6dfdbaffe98414a1759782622768ad Mon Sep 17 00:00:00 2001 From: Reflex7582Mm Date: Wed, 23 Oct 2024 12:09:55 +0700 Subject: [PATCH] add name setting instead of hardcoding --- .github/workflows/runglobal.yml | 9 +++++++-- loop.sh | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/runglobal.yml b/.github/workflows/runglobal.yml index dd5860b..9cee3bd 100644 --- a/.github/workflows/runglobal.yml +++ b/.github/workflows/runglobal.yml @@ -8,6 +8,11 @@ on: required: true default: true type: boolean + name: + description: 'Machine name' + required: true + default: 'global' + type: string oldTailscaleHostname: description: 'Old Tailscale Hostname (not needed)' required: false @@ -47,7 +52,7 @@ jobs: - name: Change Security Word run: echo "$(whoami):password1!" | sudo chpasswd - name: Start the scale to measure the weight of this server - run: sudo tailscale up --hostname="$(if ${{ inputs.runNext }}; then echo global; else echo manual-global-$(TZ=Asia/Tokyo date +%H-%M-%S); fi)" --advertise-exit-node --ssh --authkey ${{ secrets.TAILSCALE_KEY }} + run: sudo tailscale up --hostname="$(if ${{ inputs.runNext }}; then echo ${{ inputs.name }}; else echo manual-${{ inputs.name }}-$(TZ=Asia/Tokyo date +%H-%M-%S); fi)" --advertise-exit-node --ssh --authkey ${{ secrets.TAILSCALE_KEY }} - name: Fix the PS having no colors # the problem is actually the bash_profile on runner's home # but i was too lazy and simply did this (works too) @@ -92,4 +97,4 @@ jobs: chmod +x loop.sh # what an argument mess - bash loop.sh ${{ inputs.runNext }} $GH_TOKEN global runglobal.yml master global $WEBHOOK_URL true ${{ inputs.oldTailscaleHostname }} + bash loop.sh ${{ inputs.runNext }} $GH_TOKEN global runglobal.yml master ${{ inputs.name }} $WEBHOOK_URL true ${{ inputs.oldTailscaleHostname }} diff --git a/loop.sh b/loop.sh index a2dc748..377d5d4 100755 --- a/loop.sh +++ b/loop.sh @@ -80,7 +80,9 @@ check() { command+="-f \"ref=$BRANCH\" -f \"inputs[runNext]=true\" " if [[ "$IS_GLOBAL" == "true" ]]; then - command+="-f \"inputs[oldTailscaleHostname]=$hostname\"" + command+="-f \"inputs[oldTailscaleHostname]=$hostname\" " + + command+="-f \"inputs[name]=$NAME\"" cd /mnt/globalData/toBackup