Python/.gitea/workflows/rename_project.yml

43 lines
1.7 KiB
YAML
Raw Normal View History

2024-11-09 08:01:27 -08:00
name: Rename the project from template
on: [push]
permissions: write-all
jobs:
rename-project:
2024-11-09 10:39:11 -08:00
if: ${{ !endsWith (github.repository, 'Templates/Python') }}
2024-11-09 08:01:27 -08:00
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# by default, it uses a depth of 1
# this fetches all history so that we can read each commit
fetch-depth: 0
2024-11-09 09:06:45 -08:00
ref: ${{ gitea.head_ref }}
2024-11-09 08:01:27 -08:00
2024-11-09 09:12:20 -08:00
- run: echo "REPOSITORY_NAME=$(echo '${{ GITHUB_REPOSITORY }}' | awk -F '/' '{print $2}' | tr '-' '_' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
2024-11-09 08:01:27 -08:00
shell: bash
2024-11-09 09:12:20 -08:00
- run: echo "REPOSITORY_URLNAME=$(echo '${{ GITHUB_REPOSITORY }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
shell: bash
2024-11-09 08:01:27 -08:00
2024-11-09 09:12:20 -08:00
- run: echo "REPOSITORY_OWNER=$(echo '${{ GITHUB_REPOSITORY }}' | awk -F '/' '{print $1}')" >> $GITHUB_ENV
shell: bash
2024-11-09 08:01:27 -08:00
2024-11-09 09:12:20 -08:00
- name: Is this still a template
id: is_template
run: echo "::set-output name=is_template::$(ls .gitea/template.yml &> /dev/null && echo true || echo false)"
2024-11-09 08:01:27 -08:00
2024-11-09 09:12:20 -08:00
- name: Rename the project
if: steps.is_template.outputs.is_template == 'true'
run: |
echo "Renaming the project with -a(author) ${{ env.REPOSITORY_OWNER }} -n(name) ${{ env.REPOSITORY_NAME }} -u(urlname) ${{ env.REPOSITORY_URLNAME }}"
.gitea/rename_project.sh -a ${{ env.REPOSITORY_OWNER }} -n ${{ env.REPOSITORY_NAME }} -u ${{ env.REPOSITORY_URLNAME }} -d "Awesome ${{ env.REPOSITORY_NAME }} created by ${{ env.REPOSITORY_OWNER }}"
2024-11-09 08:01:27 -08:00
2024-11-09 09:12:20 -08:00
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "✅ Ready to clone and code."
# commit_options: '--amend --no-edit'
push_options: --force