Bump pip from 24.0 to 25.0 in /.github/workflows #3528
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: Reset Instance | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: | |
- main # forward-compatibility with new GitHub default branch naming | |
- master # backward-compatibility with old GitHub default branch naming | |
workflow_dispatch: | |
pull_request: | |
env: | |
COOKIECUTTER_META_PROJECT: cookiecutter-cruft-poetry-tox-pre-commit-ci-cd | |
META_PROJECT_REPO: TeoZosa/cookiecutter-cruft-poetry-tox-pre-commit-ci-cd | |
COOKIECUTTER_PROJECT_INSTANCE: cookiecutter-cruft-poetry-tox-pre-commit-ci-cd-instance | |
PROJECT_INSTANCE_REPO: TeoZosa/cookiecutter-cruft-poetry-tox-pre-commit-ci-cd-instance | |
PIP_CONSTRAINTS_FILE: .github/workflows/constraints.txt | |
jobs: | |
instance: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Check out ${{ env.COOKIECUTTER_META_PROJECT }} | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ env.COOKIECUTTER_META_PROJECT }} | |
- name: Check out ${{ env.COOKIECUTTER_PROJECT_INSTANCE }} | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ env.PROJECT_INSTANCE_REPO }} | |
path: ${{ env.COOKIECUTTER_PROJECT_INSTANCE }} | |
token: ${{ secrets.X_GITHUB_TOKEN }} | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: "3.11" | |
- name: Install cruft | |
working-directory: ${{ env.COOKIECUTTER_META_PROJECT }} | |
run: | | |
pip install --constraint="${PIP_CONSTRAINTS_FILE}" pip | |
pip install --constraint="${PIP_CONSTRAINTS_FILE}" cruft | |
- name: Remove working tree | |
run: | | |
mv "${COOKIECUTTER_PROJECT_INSTANCE}/.git" tmp.git | |
rm -rf "${COOKIECUTTER_PROJECT_INSTANCE}" | |
mkdir "${COOKIECUTTER_PROJECT_INSTANCE}" | |
mv tmp.git "${COOKIECUTTER_PROJECT_INSTANCE}/.git" | |
- name: Invoke cruft | |
run: | | |
cruft \ | |
create \ | |
https://github.com/"${META_PROJECT_REPO}" \ | |
--overwrite-if-exists \ | |
--no-input \ | |
--checkout="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}" \ | |
--extra-context="${extra_context}" | |
env: | |
extra_context: | | |
{ | |
"remote_vcs_username": "TeoZosa", | |
"project_name": "${{ env.COOKIECUTTER_PROJECT_INSTANCE }}", | |
"email": "[email protected]", | |
"project_type": "package", | |
"jupyter_notebook_project": "hybrid", | |
"adr_documentation_support": "yes", | |
"container_registry_namespace": "teozosa" | |
} | |
- name: Run README ToC generator and auto-formatting pre-commit hooks on ${{ env.COOKIECUTTER_PROJECT_INSTANCE }} | |
working-directory: ${{ env.COOKIECUTTER_PROJECT_INSTANCE }} | |
run: | | |
pip install --constraint="${PIP_CONSTRAINTS_FILE}" pre-commit | |
for hook in markdown-toc black trailing-whitespace end-of-file-fixer | |
do | |
pre-commit run "${hook}" -vv --all-files --color always || true | |
done | |
- name: Install Poetry | |
working-directory: ${{ env.COOKIECUTTER_PROJECT_INSTANCE }} | |
run: | | |
pip install --constraint="${PIP_CONSTRAINTS_FILE}" poetry | |
poetry --version | |
- name: Add poetry lockfile for ${{ env.COOKIECUTTER_PROJECT_INSTANCE }} | |
working-directory: ${{ env.COOKIECUTTER_PROJECT_INSTANCE }} | |
run: | | |
poetry update --lock | |
- name: Create commit | |
run: | | |
cd "${COOKIECUTTER_META_PROJECT}" | |
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: ${META_PROJECT_REPO}@${GITHUB_SHA::7}" | |
cd "../${COOKIECUTTER_PROJECT_INSTANCE}" | |
git config --local user.name "GitHub Action" | |
git config --local user.email "[email protected]" | |
git add . | |
git commit \ | |
--allow-empty \ | |
--author="$author" \ | |
--date="$date" \ | |
--message="$message" | |
- name: Push to instance | |
run: | | |
git \ | |
-C "${COOKIECUTTER_PROJECT_INSTANCE}" \ | |
push --force \ | |
"${COOKIECUTTER_PROJECT_INSTANCE_GIT_URL}" \ | |
HEAD:"${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}" | |
env: | |
COOKIECUTTER_PROJECT_INSTANCE_GIT_URL: "https://${{ env.GITHUB_ACTOR }}:${{ env.GITHUB_TOKEN }}@github.com/${{ env.PROJECT_INSTANCE_REPO }}.git" |