🔧 Enable ALL ruff rules (with some exceptions) #25
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: Update Demo | |
on: | |
push: | |
branches: | |
- main | |
env: | |
TEMPLATE: cookiecutter-python-package | |
CURRENT_DEMO: cookiecutter-python-package-demo-current | |
DEMO: cookiecutter-python-package-demo | |
jobs: | |
update_demo: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout ${{ env.TEMPLATE }} | |
uses: actions/checkout@v3 | |
with: | |
path: ${{ env.TEMPLATE }} | |
- name: Checkout ${{ env.DEMO }} | |
uses: actions/checkout@v3 | |
with: | |
repository: "sgraaf/${{ env.DEMO }}" | |
path: ${{ env.CURRENT_DEMO }} | |
token: ${{ secrets.X_GITHUB_PAT }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
cache: pip | |
- name: Install Dependencies | |
run: | | |
python -m pip install -r "${{ env.TEMPLATE }}/requirements.txt" | |
- name: Build Demo | |
run: | | |
cat "${{ env.TEMPLATE }}/.github/workflows/input-for-demo.txt" | cookiecutter "${{ env.TEMPLATE }}" | |
find "${{ env.DEMO }}" | |
- name: Commit and push changes | |
run: | | |
mv "${{ env.CURRENT_DEMO }}/.git" "${{ env.DEMO }}" | |
cd "${{ env.DEMO }}" | |
git config user.name "Automated" | |
git config user.email "[email protected]" | |
git add -A | |
git commit -m "Demo of ${{ env.TEMPLATE }} @ ${GITHUB_SHA::7}" || exit 0 | |
git push | |
- name: Post commit comment | |
run: | | |
export FULL_SHA=$(git rev-parse HEAD) | |
echo '{}' | \ | |
jq --arg v "Demo: https://github.com/sgraaf/${{ env.DEMO }}/tree/${FULL_SHA::7}" '. + { body: $v }' | \ | |
curl -sL \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
"$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/comments" \ | |
-d @- | |
working-directory: ${{ env.DEMO }} |