generated from KinsonDigital/CSharpLibTemplateRepo
-
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (46 loc) · 1.76 KB
/
sync-issue-to-pr.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 Issue To PR
defaults:
run:
shell: pwsh
on:
pull_request:
types: opened
issue_comment: # This event is triggered when creating issue and pr comments
types: created
jobs:
sync_issue_to_pr:
name: Start Sync Process
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '[run-sync]')) ||
github.event_name == 'pull_request' && startsWith(github.head_ref, 'feature/')
runs-on: ubuntu-latest
steps:
- name: Set Up Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Sync
run: |
$eventName = "${{ github.event_name }}";
$scriptUrl = "${{ vars.SCRIPT_BASE_URL }}/${{ vars.CICD_SCRIPTS_VERSION }}/${{ vars.SCRIPT_RELATIVE_DIR_PATH }}/sync-issue-to-pr.ts";
$issueOrPrNumber = $eventName -eq "pull_request" ? "${{ github.event.number }}" : "${{ github.event.issue.number }}";
Write-Host "::notice::Event Type: $eventName";
Write-Host "::notice::Organization Name: ${{ vars.ORGANIZATION_NAME }}";
Write-Host "::notice::Project Name: ${{ vars.PROJECT_NAME }}";
Write-Host "::notice::Requested By: ${{ github.event.sender.login }}";
Write-Host "::notice::PR Number: $issueOrPrNumber";
<# Deno Args:
1. Organization name
2. Project name
3. Triggered by user
4. Issue or pull request number
5. PAT
#>
deno run `
--allow-net `
"$scriptUrl" `
"${{ vars.ORGANIZATION_NAME }}" `
"${{ vars.PROJECT_NAME }}" `
"${{ github.event.sender.login }}" `
"$issueOrPrNumber" `
"${{ secrets.CICD_TOKEN }}";