-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (48 loc) · 1.91 KB
/
Copy pathsync.yaml
File metadata and controls
57 lines (48 loc) · 1.91 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
56
57
name: Upstream Sync
permissions:
contents: write
actions: write
on:
workflow_dispatch:
inputs:
manual-trigger:
description: 'This will pull the upstream code while preserving your configuration file. Configuration file compatibility is not guaranteed, and you may need to manually update the configuration file after pulling.'
type: boolean
required: true
default: false
override-token:
description: '[Optional] Paste a PAT here. If left blank, PAT_TOKEN secret will be used (if set). Used to solve `refusing to allow a GitHub App to create or update workflow... `, more info at https://github.com/lyc8503/UptimeFlare/wiki/Synchronize-updates-from-upstream#upgrade-methods'
required: false
jobs:
sync_latest_from_upstream:
name: Sync latest commits from upstream repo
runs-on: ubuntu-latest
steps:
- name: Checkout target repo
uses: actions/checkout@v3
with:
token: ${{ inputs.override-token || secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
- name: Current config
run: |
cat uptime.config.ts
cp uptime.config.ts /tmp/origin.config.ts
- name: Sync upstream changes
id: sync
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Fetch latest code
git clone https://github.com/lyc8503/UptimeFlare /tmp/latest
rm -rf /tmp/latest/.git
# Clean current repo and update
git rm -rf '*'
cp -r /tmp/latest/. .
cp /tmp/origin.config.ts uptime.config.ts
git add .
git commit -m "Sync latest code from upstream"
git push
- name: Trigger deployment
if: ${{ inputs.override-token == '' }}
uses: benc-uk/workflow-dispatch@v1
with:
workflow: deploy.yml