Skip to content

Commit 1f8290a

Browse files
authored
Merge branch 'main' into main
2 parents b33ac39 + ae06309 commit 1f8290a

File tree

1 file changed

+30
-16
lines changed

1 file changed

+30
-16
lines changed

.github/workflows/main.yml

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ jobs:
3131
# Setup & Configuration
3232
Setup:
3333
name: "Setup & Configuration "
34-
if: ${{ !(github.event.pull_request.head.repo.fork && github.ref == 'refs/heads/main') }}
3534
runs-on: ubuntu-latest
3635
outputs:
3736
GitVersion_BranchName: ${{ steps.gitversion.outputs.GitVersion_BranchName }}
@@ -59,7 +58,15 @@ jobs:
5958
uses: actions/checkout@v4
6059
with:
6160
fetch-depth: 0
62-
61+
- name: "Fix contibutions if main"
62+
shell: pwsh
63+
if: ${{ (github.event.pull_request.head.repo.fork && github.ref == 'refs/heads/main') }}
64+
id: contributionbranchfix
65+
run: |
66+
# Get environment variables
67+
$branchName = "pr-temp-${{ github.event.pull_request.number }}"
68+
$newBranchName = "contrib/$branchName"
69+
git checkout -b $newBranchName
6370
- name: Install GitVersion
6471
uses: gittools/actions/gitversion/[email protected]
6572
with:
@@ -160,23 +167,30 @@ jobs:
160167
Write-Output "-------------------------------------------"
161168
Write-Output "Get-ReleaseDescription"
162169
Write-Output "-------------------------------------------"
163-
Write-Output "Running Get-ReleaseDescription.ps1"
164-
. .\build\include\Get-ReleaseDescription.ps1
165-
$description = Get-ReleaseDescription -mode log -OPEN_AI_KEY ${{ secrets.OPENAI_API_KEY }}
166-
if ($description -eq $null) {
167-
$description = "No release description found";
168-
echo "release_description_state=false" >> $env:GITHUB_OUTPUT
169-
} else {
170-
echo "release_description_state=true" >> $env:GITHUB_OUTPUT
170+
if ($env:GITHUB_EVENT_NAME -ne "pull_request" -and $eventName -ne "pull_request_target")
171+
{
172+
Write-Output "Running Get-ReleaseDescription.ps1"
173+
. .\build\include\Get-ReleaseDescription.ps1
174+
$description = Get-ReleaseDescription -mode log -OPEN_AI_KEY ${{ secrets.OPENAI_API_KEY }}
175+
if ($description -eq $null) {
176+
$description = "No release description found";
177+
echo "release_description_state=false" >> $env:GITHUB_OUTPUT
178+
} else {
179+
echo "release_description_state=true" >> $env:GITHUB_OUTPUT
171180
181+
}
182+
$EOF = -join (1..15 | ForEach {[char]((48..57)+(65..90)+(97..122) | Get-Random)})
183+
echo "release_description<<$EOF" >> $env:GITHUB_OUTPUT
184+
echo $description >> $env:GITHUB_OUTPUT
185+
echo "$EOF" >> $env:GITHUB_OUTPUT
186+
} else {
187+
$description = "Skipping for PR!"
188+
echo "release_description=$description" >> $env:GITHUB_OUTPUT
189+
Write-Output $description
172190
}
173-
$EOF = -join (1..15 | ForEach {[char]((48..57)+(65..90)+(97..122) | Get-Random)})
174-
echo "release_description<<$EOF" >> $env:GITHUB_OUTPUT
175-
echo $description >> $env:GITHUB_OUTPUT
176-
echo "$EOF" >> $env:GITHUB_OUTPUT
191+
177192
Write-Output "-------------------------------------------"
178193
Write-Output "::endgroup::"
179-
180194
- uses: actions/upload-artifact@v4
181195
with:
182196
name: AzureDevOpsMigrationTools-Scripts
@@ -541,7 +555,7 @@ jobs:
541555
name: "Release to Docs"
542556
runs-on: ubuntu-latest
543557
needs: [Setup, BuildDocs]
544-
if: ${{ success() }}
558+
if: ${{ !(github.event.pull_request.head.repo.fork) }}
545559
steps:
546560
- name: Download a single artifact
547561
uses: actions/download-artifact@v4

0 commit comments

Comments
 (0)