-
Notifications
You must be signed in to change notification settings - Fork 3
98 lines (88 loc) · 3.86 KB
/
file-automatic-issues.yml
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Code adapted from https://github.com/JetBrains/intellij-platform-plugin-template/blob/deb171483598ee8a5d7621154db880e87b4db4ef/.github/workflows/template-cleanup.yml
# by Candace Savonen for this repository.
name: Starting a website
on:
push:
branches: [ main, staging ]
workflow_dispatch:
jobs:
# Run cleaning process only if workflow is triggered by not being in the Bookdown template anymore
template-cleanup:
name: Template Cleanup
runs-on: ubuntu-latest
if: github.event.repository.name != 'OTTR_Template_Website'
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: Login as github actions bot
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# Delete Template-specific files that aren't needed for new websites
# Cleanup Template-specific bits
- name: Cleanup
run: |
rm -rf \
.github/workflows/file-automatic-issues.yml \
.github/ISSUE_TEMPLATE/new-website-add-to-sync.md \
.github/ISSUE_TEMPLATE/update-website-info-for-sync.md \
.github/ISSUE_TEMPLATE/website-template-feature-request.md \
.github/ISSUE_TEMPLATE/website-template-problem-report.md \
.github/PULL_REQUEST_TEMPLATE/add_to_sync_template.md \
.github/sync.yml \
.github/workflows/send-updates.yml \
.github/workflows/test-send-updates.yml \
docs/*.html
# Commit deleted files
- name: Commit deleted files
id: commit_it
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
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 "Template cleanup"
pushed_it=true
git push || pushed_it=false
echo "pushed_it=$pushed_it" >> $GITHUB_OUTPUT
# If main is already protected, then file a PR
- name: Create a PR with deleted files
if: steps.commit_it.outputs.pushed_it == 'false'
uses: peter-evans/create-pull-request@v3
id: pr
with:
commit-message: Delete unnecessary files
signoff: false
branch: auto_copy_rendered_files
delete-branch: true
title: 'Automatic course set up'
body: |
### Description:
This PR was initiated by the github actions. It helps set up this repository to be ready to create your website.
It deletes some remnant files you don't need for your website but were used when this was a template.
labels: |
automated
reviewers: $GITHUB_ACTOR
token: ${{secrets.GH_PAT}}
# Issue for what repository settings need to be set
- name: New Course - Set Repository Settings
uses: peter-evans/create-issue-from-file@v4
with:
title: New Course - Set Repository Settings
content-filepath: .github/automatic-issues/set-repo-settings.md
labels: automated training issue
# Issue for what needs to be edited
- name: New Course - Templates to Edit
uses: peter-evans/create-issue-from-file@v4
with:
title: New Course - Templates to Edit
content-filepath: .github/automatic-issues/templates-to-edit.md
labels: automated training issue
# Issue for how to enroll repo for updates
- name: New Course - Template Update Enrollment
uses: peter-evans/create-issue-from-file@v4
with:
title: New Course - Template Update Enrollment
content-filepath: .github/automatic-issues/update-enrollment.md
labels: automated training issue