-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reset instance on push to main (#71)
* Pin cookiecutter version for GitHub workflow * Add workflow to reset instance * Fix typo in repository name
- Loading branch information
1 parent
17c398c
commit 4b8a77a
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pip==20.2.4 | ||
pre-commit==2.8.2 | ||
nox==2020.8.22 | ||
cookiecutter==1.7.2 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Reset instance | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
instance: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out cookiecutter-homeassistant-custom-component | ||
uses: actions/checkout@v2.3.4 | ||
with: | ||
path: cookiecutter-homeassistant-custom-component | ||
- name: Check out cookiecutter-homeassistant-custom-component-instance | ||
uses: actions/checkout@v2.3.4 | ||
with: | ||
repository: "oncleben31/cookiecutter-homeassistant-custom-component-instance" | ||
path: cookiecutter-homeassistant-custom-component-instance | ||
token: ${{ secrets.X_GITHUB_TOKEN }} | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2.1.4 | ||
with: | ||
python-version: "3.9" | ||
- name: Install cookiecutter | ||
working-directory: cookiecutter-homeassistant-custom-component | ||
run: | | ||
pip install --constraint=.github/workflows/constraints.txt pip | ||
pip install --constraint=.github/workflows/constraints.txt cookiecutter | ||
- name: Remove working tree | ||
run: | | ||
mv cookiecutter-homeassistant-custom-component-instance/.git tmp.git | ||
rm -rf cookiecutter-homeassistant-custom-component-instance | ||
mkdir cookiecutter-homeassistant-custom-component-instance | ||
mv tmp.git cookiecutter-homeassistant-custom-component-instance/.git | ||
- name: Invoke cookiecutter | ||
run: >- | ||
cookiecutter | ||
https://github.com/${GITHUB_REPOSITORY} | ||
--overwrite-if-exists | ||
--no-input | ||
friendly_name="Cookiecutter Home Assistant Custom Component Instance" | ||
domain_name=cookiecutter_homeassistant_custom_component_instance | ||
project_name=cookiecutter-homeassistant-custom-component-instance | ||
- name: Create commit | ||
run: | | ||
cd cookiecutter-homeassistant-custom-component | ||
author="$(git show --no-patch --format='%an <%ae>')" | ||
date="$(git show --no-patch --format=%ad)" | ||
message="$(git show --no-patch --format=%B | sed 's/ *(#[0-9]\+)//g') | ||
Original-Commit: ${GITHUB_REPOSITORY}@${GITHUB_SHA::7}" | ||
cd ../cookiecutter-homeassistant-custom-component-instance | ||
git config --local user.name "GitHub Action" | ||
git config --local user.email "action@github.com" | ||
git add . | ||
git commit --allow-empty --author="$author" --date="$date" --message="$message" | ||
- name: Push to instance | ||
run: >- | ||
git | ||
-C cookiecutter-homeassistant-custom-component-instance | ||
push | ||
https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/oncleben31/cookiecutter-homeassistant-custom-component-instance.git | ||
HEAD:main |