Patch file preact/0.58.1 #27
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "[email protected]" | |
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" \ | |
--reviewer "searchspring/snap-team" | |
env: | |
GITHUB_TOKEN: ${{ secrets.MACHINE_ACTION_WORKFLOW_PAT }} |