-
Notifications
You must be signed in to change notification settings - Fork 10
55 lines (46 loc) · 2.01 KB
/
sync-template.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
name: Sync Template
# NOTE: requires a secrets.GITHUB_TOKEN with permissions to update .github/workflows/
#https://github.com/peter-evans/create-pull-request/blob/main/docs/examples.md#keep-a-fork-up-to-date-with-its-upstream
on: workflow_dispatch
jobs:
sync-template:
runs-on: ubuntu-20.04
steps:
- name: Get Repository Name
run: echo "PACKAGE_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: Checkout Template Repository
uses: actions/checkout@v2
with:
repository: stactools-packages/template
path: template
- name: Checkout Package Repository
uses: actions/checkout@v2
with:
path: ${{env.PACKAGE_NAME}}
# NOTE: this is not very sophisticated, just copies files from specific subfolders
# will not reconcile deleted or renamed files
- name: Update Select Template Changes
run: |
# Directories
cp -r ./template/scripts/* ./${{env.PACKAGE_NAME}}/scripts/
cp -r ./template/docker/* ./${{env.PACKAGE_NAME}}/docker/
cp -r ./template/.github/* ./${{env.PACKAGE_NAME}}/.github/
# Single files added after initial use of template
cp ./template/CHANGELOG.md ./${{env.PACKAGE_NAME}}/
cp ./template/CODE_OF_CONDUCT.md ./${{env.PACKAGE_NAME}}/
cp ./template/CONTRIBUTING.md ./${{env.PACKAGE_NAME}}/
cp ./template/.dockerignore ./${{env.PACKAGE_NAME}}/
cp ./template/docker_env ./${{env.PACKAGE_NAME}}/
cp ./template/.editorconfig ./${{env.PACKAGE_NAME}}/
cp ./template/mypy.ini ./${{env.PACKAGE_NAME}}/
cp ./template/requirements-dev.txt ./${{env.PACKAGE_NAME}}/
- name: Run Rename Script
run: |
./${{env.PACKAGE_NAME}}/scripts/rename
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
path: ${{env.PACKAGE_NAME}}
token: ${{ secrets.TOKEN }}
title: Sync with stacktools-packages/template
body: Pulled upstream changes from https://github.com/stactools-packages/template