Skip to content

Commit

Permalink
explicit sync action input on branch
Browse files Browse the repository at this point in the history
otherwise github requires the {OS}-one branches to contain
the github workflow as well (which we preferably avoid).
  • Loading branch information
v4hn committed Sep 9, 2024
1 parent e03ee9c commit 8842ae3
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/sync-unstable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,34 @@ name: sync-unstable

on:
workflow_dispatch:
inputs:
branch:
description: 'branch to sync to (no -unstable suffix)'
required: true

jobs:
sync:
runs-on: ubuntu-22.04
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

0 comments on commit 8842ae3

Please sign in to comment.