-
Notifications
You must be signed in to change notification settings - Fork 5
56 lines (52 loc) · 1.7 KB
/
main.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: good-first-issues
on:
pull_request: []
workflow_dispatch:
schedule:
- cron: 5 20 * * *
push:
branches:
- main
jobs:
good-first-issues:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update Repos
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python .github/scripts/add-repos.py
# This is customized from the action to not add a body
- name: Generate First Issues
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
rm -rf docs/_issues
mkdir -p docs/_issues
python .github/scripts/generate-first-issues.py
- name: Update Repository
if: (github.event_name != 'pull_request')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
UPDATE_BRANCH: "main"
run: |
printf "GitHub Actor: ${GITHUB_ACTOR}\n"
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git branch
printf "Branch to push to is ${UPDATE_BRANCH}\n"
git checkout ${UPDATE_BRANCH} || git checkout -b ${UPDATE_BRANCH}
git branch
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
git pull origin ${UPDATE_BRANCH}
git add docs/*
git add docs/_issues/*
git add .github/repos.txt
git add .github/empty.txt
if git diff-index --quiet HEAD --; then
printf "No changes\n"
else
printf "Changes\n"
git commit -a -m "Automated deployment to update first issues $(date '+%Y-%m-%d')"
git push origin ${UPDATE_BRANCH}
fi