-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (48 loc) · 1.65 KB
/
generate-config.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
name: Generate Config
on:
push:
workflow_dispatch:
inputs:
repository-name:
description: 'The name of the repository'
required: false
default: ''
type: string
permissions:
contents: write
jobs:
generate-config:
if: github.ref_name == github.event.repository.default_branch
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check if config has been generated
id: check-config
run: |
if [ -f ".github/ISSUE_TEMPLATE/issue_template_configured.txt" ]; then
echo "Config already generated"
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "Config not generated yet"
echo "skip=false" >> $GITHUB_OUTPUT
fi
- name: Set up Git
if: steps.check-config.outputs.skip == 'false'
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Run generate_config.sh
if: steps.check-config.outputs.skip == 'false'
run: |
chmod +x .github/scripts/generate_config.sh
.github/scripts/generate_config.sh ${{ github.event.inputs.repository-name || github.repository }}
- name: Commit and push generated config
if: steps.check-config.outputs.skip == 'false'
run: |
git add .github/ISSUE_TEMPLATE/config.yml
git add .github/ISSUE_TEMPLATE/issue_template_configured.txt
git commit -m "Update generated config.yml and issue_template_configured.txt"
git push