-
Notifications
You must be signed in to change notification settings - Fork 2.3k
55 lines (51 loc) · 1.94 KB
/
backport.yml
File metadata and controls
55 lines (51 loc) · 1.94 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
name: Port changes to PoB2
run-name: "Port PR #${{ github.event.pull_request.number || inputs.pr_number }} - ${{ github.event.pull_request.title || 'Manual dispatch' }}"
on:
pull_request_target:
types: [closed]
workflow_dispatch:
inputs:
pr_number:
description: PoB1 PR number to port
required: true
type: number
jobs:
backport:
if: github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'pob2'))
runs-on: ubuntu-latest
steps:
- name: Determine PR number
run: |
if [ "${{ github.event_name }}" = "pull_request_target" ]; then
echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> "$GITHUB_ENV"
else
echo "PR_NUMBER=${{ github.event.inputs.pr_number }}" >> "$GITHUB_ENV"
fi
- name: Fetch PR details
id: payload
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: process.env.PR_NUMBER
});
const labels = pr.data.labels.map(l => l.name).join(',');
return JSON.stringify({
patch_url: pr.data.patch_url,
msg: `Apply changes from ${pr.data.html_url}`,
id: pr.data.number,
title: pr.data.title,
labels,
name: pr.data.user.name || pr.data.user.login,
user: pr.data.user.login,
});
- name: Notify PathOfBuilding-PoE2 repo
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.WIRES77_PAT }}
repository: ${{ github.repository_owner }}/PathOfBuilding-PoE2
event-type: port-changes
client-payload: ${{ steps.payload.outputs.result }}