Skip to content

Commit 28bd895

Browse files
committed
Set up publishing of SNAPSHOT builds to GitHub Packages
* Added workflow for publishing `SNAPSHOT` builds. * Added workflow for removing `SNAPSHOT` builds once a pull request has been merged.
1 parent efeb183 commit 28bd895

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: Build and test
22
on:
33
# Build PRs and branches.
4-
pull_request:
4+
pull_request_target:
5+
types: [ opened, synchronize, reopened ]
56
paths-ignore:
67
- .github/workflows/deploy-tagged.yml
78
push:
@@ -51,7 +52,7 @@ jobs:
5152
name: Publish snapshot to GitHub Packages
5253
runs-on: ubuntu-latest
5354
needs: build
54-
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/master')
55+
if: github.event_name == 'pull_request_target' || (github.event_name == 'push' && github.ref == 'refs/heads/master') && github.event.pull_request.head.repo.full_name == github.repository
5556
permissions:
5657
contents: read
5758
packages: write
@@ -71,7 +72,7 @@ jobs:
7172
- name: Determine snapshot version
7273
id: snapshot-version
7374
run: |
74-
if [ "${{ github.event_name }}" == "pull_request" ]; then
75+
if [ "${{ github.event_name }}" == "pull_request_target" ]; then
7576
SNAPSHOT_VERSION="${{ steps.get-version.outputs.base_version }}-PR-${{ github.event.pull_request.number }}-SNAPSHOT"
7677
else
7778
SNAPSHOT_VERSION="${{ steps.get-version.outputs.base_version }}-SNAPSHOT"

0 commit comments

Comments
 (0)