Skip to content

Commit 27debc0

Browse files
committed
Updating pr build workflow to react to comments
1 parent 6887898 commit 27debc0

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

.github/workflows/pr-build.yaml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,28 @@ on:
66
paths-ignore:
77
- "**.md"
88
- "LICENSE"
9+
issue_comment:
10+
types: [created]
911

1012
jobs:
13+
isCodeOwner:
14+
if: github.event.issue.pull_request && contains(github.event.comment.body, '/test-pack')
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
- name: Check if comment author is a code owner
20+
id: check
21+
run: |
22+
CODEOWNERS=$(cat .github/CODEOWNERS)
23+
COMMENT_AUTHOR=${{ github.event.comment.user.login }}
24+
if echo "$CODEOWNERS" | grep -q "$COMMENT_AUTHOR"; then
25+
echo "::set-output name=isCodeOwner::true"
26+
else
27+
echo "::set-output name=isCodeOwner::false"
28+
fi
1129
build-release:
1230
runs-on: windows-latest
13-
needs: []
1431
steps:
1532
- uses: actions/checkout@v4
1633

@@ -21,9 +38,19 @@ jobs:
2138

2239
- name: dotnet build
2340
run: dotnet build -c release
41+
42+
- name: dotnet publish
43+
if: steps.isCodeOwner.outputs.isCodeOwner == 'true'
44+
run: dotnet publish -o pub -c release -p:PublishSingleFile=true -p:Version=${{ env.APP_VERSION }}
45+
46+
- name: Upload binaries
47+
if: steps.isCodeOwner.outputs.isCodeOwner == 'true'
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: binaries
51+
path: pub/FileSorter.*
2452
build-debug:
2553
runs-on: windows-latest
26-
needs: []
2754
steps:
2855
- uses: actions/checkout@v4
2956

0 commit comments

Comments
 (0)