Skip to content

Commit 018353f

Browse files
committed
add event dispatcher to bypass gh limitations
1 parent 602f628 commit 018353f

3 files changed

Lines changed: 23 additions & 14 deletions

File tree

.github/actions/has-changes/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ runs:
8080
8181
$SelectedProject = "${{ inputs.project }}"
8282
83-
$currentHash = git rev-parse origin/main
83+
$currentHash = git rev-parse HEAD
8484
if (-not $currentHash) {
85-
Write-Host "Cannot fetch hash of origin/main"
85+
Write-Host "Cannot fetch hash of HEAD"
8686
exit 1
8787
}
8888
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: "service::event_dispatcher::pull_request::closed::main"
2+
on:
3+
pull_request:
4+
types: [closed]
5+
branches: [main]
6+
7+
jobs:
8+
mark:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Emit metadata
12+
run: echo "Running for PR ${{ github.event.number }} state=${{ github.event.action }}"

.github/workflows/update-nuspec.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
name: Update nuspec files
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
force:
7-
required: true
8-
type: boolean
9-
default: false
10-
description: "Force recreation of nuspec files"
11-
pull_request:
12-
types:
13-
- closed
14-
branches:
15-
- main
4+
workflow_run:
5+
workflows: ["service::event_dispatcher::pull_request::closed::main"]
6+
types:
7+
- completed
168

179
concurrency:
1810
group: update-nuspec
@@ -21,6 +13,11 @@ concurrency:
2113
jobs:
2214
validate:
2315
runs-on: ubuntu-latest
16+
if: >
17+
github.event.workflow_run.event == 'pull_request' &&
18+
github.event.workflow_run.conclusion == 'success' &&
19+
fromJson(github.event.workflow_run.payload).pull_request.state == 'closed' &&
20+
fromJson(github.event.workflow_run.payload).pull_request.base.ref == 'main'
2421
env:
2522
PULL_REQUEST_MERGED: ${{ github.event.pull_request.merged }}
2623
outputs:

0 commit comments

Comments
 (0)