forked from armbian/build
-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (40 loc) · 1.48 KB
/
forked-helper.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
name: Forked Helper
on:
push:
release:
deployment:
pull_request:
workflow_dispatch:
jobs:
fork-repository-dispatch:
name: 📢 Run repository dispatch to default fork branch
if: ${{ github.repository_owner != 'armbian' }}
runs-on: ubuntu-latest
steps:
- name: Assign secret
id: get_dispatch_secret
run: echo '::set-output name=dispatch_secret::${{ secrets.ARMBIAN_SELF_DISPATCH_TOKEN }}'
- name: Get event details
id: get_event_details
# Process JSON according https://github.community/t5/GitHub-Actions/set-output-Truncates-Multiline-Strings/td-p/37870
run: |
JSON=$(cat ${{ github.event_path }})
JSON="${JSON//'%'/'%25'}"
JSON="${JSON//$'\n'/'%0A'}"
JSON="${JSON//$'\r'/'%0D'}"
echo "::set-output name=event_details::${JSON}"
- name: Dispatch event on forked repostitory
if: steps.get_dispatch_secret.outputs.dispatch_secret
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ steps.get_dispatch_secret.outputs.dispatch_secret }}
repository: ${{ github.repository }}
event-type: armbian
client-payload: >
{
"event": "${{ github.event_name }}",
"ref": "${{ github.ref }}",
"base_ref": "${{ github.base_ref }}",
"sha": "${{ github.sha }}",
"event_details": ${{ steps.get_event_details.outputs.event_details }}
}