-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (46 loc) · 1.75 KB
/
initial_setup.yml
File metadata and controls
55 lines (46 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Initial Template Setup
on:
push:
branches: [main]
permissions:
contents: write # Grant write access to push changes
jobs:
run-setup:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }} # Ensure correct permissions
- name: Get repository name
id: repo_name
run: echo "REPO_NAME=${{ github.event.repository.name }}" >> $GITHUB_ENV
- name: Check if repo is different from template_repo
if: env.REPO_NAME != 'python_env_devcontainer_template'
run: echo "Proceeding with renaming..."
- name: Verify renaming script exists
id: check_script
if: env.REPO_NAME != 'python_env_devcontainer_template'
run: |
if [ ! -f run_me_first.sh ]; then
echo "No renaming needed"
exit 78
fi
- name: Run renaming script
if: env.REPO_NAME != 'python_env_devcontainer_template'
run: bash ./run_me_first.sh
- name: Commit changes
if: env.REPO_NAME != 'python_env_devcontainer_template'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Run template renaming" || echo "Nothing to commit"
git push origin main
- name: Remove initial setup workflow
if: env.REPO_NAME != 'python_env_devcontainer_template'
run: |
rm -f .github/workflows/initial_setup.yml
git add .github/workflows/initial_setup.yml
git commit -m "Remove initial setup workflow" || echo "Nothing to commit"
git push origin main