fix: update actions/setup-python action to v5.3.0 (#159) #91
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: Initialize Repository | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
issues: write | |
jobs: | |
setup: | |
if: ${{ ! contains(github.repository, 'template') }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
egress-policy: block | |
allowed-endpoints: > | |
api.github.com:443 | |
files.pythonhosted.org:443 | |
github.com:443 | |
pypi.org:443 | |
- name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Setup labels for the repository | |
run: gh label clone inovintell/template --force | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update repository name | |
uses: jossef/action-set-json-field@2a0f7d953b580b828717daf4de7fafc7e4135e97 # tag=v2 | |
with: | |
file: cookiecutter.json | |
field: repository | |
value: ${{ github.event.repository.name }} | |
- name: Update repository owner | |
uses: jossef/action-set-json-field@2a0f7d953b580b828717daf4de7fafc7e4135e97 # tag=v2 | |
with: | |
file: cookiecutter.json | |
field: repository_owner | |
value: ${{ github.repository_owner }} | |
- name: Setup Python | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: 3.x | |
- name: Install cookiecutter | |
run: pip install cookiecutter | |
- name: Hack cookiecutter to work with GH Actions | |
id: hack | |
working-directory: ${{ github.workspace }}/../ | |
run: | | |
rm ${{ github.event.repository.name }}/.github/workflows/initialization.yml | |
mv ${{ github.event.repository.name }}/cookiecutter.json ./ | |
mv ${{ github.event.repository.name }} '{{cookiecutter.repository}}' | |
echo "::set-output name=working_directory::$(pwd)" | |
- name: Create repo from template | |
working-directory: ${{ steps.hack.outputs.working_directory }}/../ | |
run: > | |
cookiecutter --verbose --no-input | |
${{ github.event.repository.name }} | |
--output-dir ./${{ github.event.repository.name }} | |
- name: Push changes | |
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 # v5.0.1 | |
with: | |
commit_user_name: github-actions[bot] | |
commit_user_email: github-actions[bot]@users.noreply.github.com | |
commit_message: 'fix: setup template repository [skip ci]' | |
add_options: --all | |
push_options: --force |