From 8842ae300d85ba7050a881ed1a9feb3563903744 Mon Sep 17 00:00:00 2001 From: v4hn Date: Mon, 9 Sep 2024 23:05:36 +0200 Subject: [PATCH] explicit sync action input on branch otherwise github requires the {OS}-one branches to contain the github workflow as well (which we preferably avoid). --- .github/workflows/sync-unstable.yaml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/sync-unstable.yaml b/.github/workflows/sync-unstable.yaml index ed64d67604..eea87ad570 100644 --- a/.github/workflows/sync-unstable.yaml +++ b/.github/workflows/sync-unstable.yaml @@ -2,6 +2,10 @@ name: sync-unstable on: workflow_dispatch: + inputs: + branch: + description: 'branch to sync to (no -unstable suffix)' + required: true jobs: sync: @@ -9,24 +13,23 @@ jobs: steps: - name: checkout unstable branch uses: actions/checkout@v4 - - name: validate branch - run: | - if [[ ${{ github.event.inputs.repo }} != *-unstable ]]; then - echo "This workflow is only meant for -unstable branches" - exit 1 - fi + with: + ref: ${{ github.event.inputs.branch }}-unstable + fetch-depth: 0 - name: Strip -unstable suffix run: | - echo "BRANCH=$(echo ${{ github.event.inputs.repo }} | sed 's/-unstable$//')" >> $GITHUB_ENV find . -type f -exec sed -i 's/-unstable//g' {} + - name: Add sync date to README run: | sed -i "/ Date/ a | Synced As Stable | $(date) |" README.md + - name: Get path to sync + run: | + echo "folder=$(pwd)" >> $GITHUB_ENV - name: Deploy uses: s0/git-publish-subdir-action@develop env: REPO: self - BRANCH: ${{ env.BRANCH }} - FOLDER: . + BRANCH: ${{ github.event.inputs.branch }} + FOLDER: ${{ env.folder }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SQUASH_HISTORY: true