Skip to content

Patch file preact/0.55.0 #16

Patch file preact/0.55.0

Patch file preact/0.55.0 #16

Workflow file for this run

name: Patch Scaffolds
on:
pull_request:
types: [closed]
branches:
- main
jobs:
scaffold-matrix:
runs-on: ubuntu-latest
steps:
- id: scaffolds
run: |
framework=`echo '${{ github.head_ref }}' | jq -Rr 'split("-")[2]'`;
scaffolds=$(gh search repos --owner searchspring "snapfu-scaffold-$framework" --json name --jq '[.[].name]')
echo "scaffolds=$scaffolds" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.MACHINE_ACTION_WORKFLOW_PAT }}
outputs:
scaffolds: ${{ steps.scaffolds.outputs.scaffolds }}
patch-scaffold:
if: github.event.pull_request.merged == true && startsWith( github.head_ref, 'patch-generate-' ) == true && needs.scaffold-matrix.outputs.scaffolds != '[]'
runs-on: ubuntu-latest
needs:
- scaffold-matrix
strategy:
matrix:
scaffold: ${{ fromJSON(needs.scaffold-matrix.outputs.scaffolds) }}
steps:
- name: Extract Variables
id: variables
run: |
framework=`echo '${{ github.head_ref }}' | jq -Rr 'split("-")[2]'`;
echo "::set-output name=framework::$framework";
echo "Using framework: $framework";
version=`echo '${{ github.head_ref }}' | jq -Rr 'split("-")[3]'`;
echo "::set-output name=version::$version";
echo "Using version: $version";
- name: Validate Variables
run: |
if [ "${{ steps.variables.outputs.framework }}" == "" ]; then
echo "Could not determine framework";
exit 1;
fi;
if [ "${{ steps.variables.outputs.version }}" == "" ]; then
echo "Could not determine version";
exit 1;
fi;
- name: Setup Node
id: setup-node
uses: actions/setup-node@v2
with:
node-version: 16
- name: Install Snapfu
run: |
npm install -g snapfu
- name: Checkout Scaffold
uses: actions/checkout@v3
with:
repository: "searchspring/${{ matrix.scaffold }}"
path: "${{ matrix.scaffold }}"
ref: "production"
token: ${{ secrets.MACHINE_ACTION_WORKFLOW_PAT }}
- name: Patch Scaffold
working-directory: ${{ matrix.scaffold }}
run: |
git config --global user.name "searchspring-machine"
git config --global user.email "machine@searchspring.com"
git checkout -b patch-${{ matrix.scaffold }}-${{ steps.variables.outputs.version }}
snapfu patch fetch
snapfu patch apply ${{ steps.variables.outputs.version }} --ci
git add .
git commit -m "auto generated scaffolding patch from 'Patch Scaffold' action workflow"
git push -u origin patch-${{ matrix.scaffold }}-${{ steps.variables.outputs.version }}
- name: Create PR
run: |
gh pr create \
--title "Patch Scaffold ${{ matrix.scaffold }} to ${{ steps.variables.outputs.version }}" \
--body "" \
--repo "https://github.com/searchspring/${{ matrix.scaffold }}" \
--base "production" \
--head "patch-${{ matrix.scaffold }}-${{ steps.variables.outputs.version }}" \
--project "Snap Beta" \
--reviewer "searchspring/snap-team"
env:
GITHUB_TOKEN: ${{ secrets.MACHINE_ACTION_WORKFLOW_PAT }}