Skip to content

Commit

Permalink
automated duplicating imported samples modifications (#595)
Browse files Browse the repository at this point in the history
* automated duplicating imported samples modifications using pre-commit and a bash script duplicate_package_sample.sh

* Pre Commit config file added

* added bash execution in pre commit config file

* entry path changed

* entry changed

* entry path changed

* added always run to pre-commit

* changed type

* removed pre-commit config yaml brought back GitHub workflow solution

* extra commit author changed to git actor

* workflow working branch switched back to main

---------

Co-authored-by: Peter Kalambet <[email protected]>
  • Loading branch information
robGG1997 and kalambet authored Sep 14, 2023
1 parent 3eb85b2 commit a555894
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/duplicate_sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Duplicate-Package-Sample

on:
push:
branches:
- main

jobs:
duplicate:
name: duplicate package sample
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Run duplicate script file
run: bash ${GITHUB_WORKSPACE}/duplicate_package_sample.sh

- name: Commit and Push
run: |
git config --global user.email $git_email
git config --global user.name "${{ github.actor }}"
git add ./src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/. -f
git diff-index --cached --quiet HEAD || git commit -m "Auto-duplicate Package Samples"
git push
env:
git_email: "${{ github.actor }}@users.noreply.github.com"
14 changes: 14 additions & 0 deletions duplicate_package_sample.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Specify the source directory and the destination directory
SOURCE_DIRECTORY="src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0-pre001/Web3.Unity Samples/"
DESTINATION_DIRECTORY="src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/"

# clear destination directory first
rm -r "$DESTINATION_DIRECTORY"

# Copy source to the destination
cp -r "$SOURCE_DIRECTORY" "$DESTINATION_DIRECTORY"

#add all modified files
git add "src/UnityPackages/io.chainsafe.web3-unity/Samples~/Web3.Unity/." -f

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a555894

Please sign in to comment.