mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-23 13:07:07 +01:00
Infer SHA from github context
This commit is contained in:
@@ -30,9 +30,6 @@ on:
|
||||
pull_request_number:
|
||||
description: 'Pull Request Number'
|
||||
required: true
|
||||
pull_request_current_merge_sha:
|
||||
description: 'Pull Request Merge SHA'
|
||||
required: true
|
||||
|
||||
env:
|
||||
TGS_DOTNET_VERSION: 8
|
||||
@@ -78,7 +75,7 @@ jobs:
|
||||
|
||||
- name: Abort if PR Merge SHA has Changed
|
||||
uses: actions/github-script@v7
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != inputs.pull_request_current_merge_sha
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != github.sha
|
||||
with:
|
||||
script: |
|
||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
@@ -107,7 +104,7 @@ jobs:
|
||||
path: ./release_notes_bins/
|
||||
|
||||
- name: Set CI Check Run (Started)
|
||||
run: dotnet release_notes_bins/Tgstation.Server.ReleaseNotes.dll --ci-check ${{ github.event.inputs.pull_request_current_merge_sha }} ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }} Started ${{ github.run_id }}
|
||||
run: dotnet release_notes_bins/Tgstation.Server.ReleaseNotes.dll --ci-check ${{ github.sha }} ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }} Started ${{ github.run_id }}
|
||||
|
||||
code-scanning:
|
||||
name: Code Scanning
|
||||
@@ -143,7 +140,7 @@ jobs:
|
||||
|
||||
- name: Abort if PR Merge SHA has Changed
|
||||
uses: actions/github-script@v7
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != inputs.pull_request_current_merge_sha
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != github.sha
|
||||
with:
|
||||
script: |
|
||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
@@ -249,7 +246,7 @@ jobs:
|
||||
|
||||
- name: Abort if PR Merge SHA has Changed
|
||||
uses: actions/github-script@v7
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != inputs.pull_request_current_merge_sha
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != github.sha
|
||||
with:
|
||||
script: |
|
||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
@@ -326,7 +323,7 @@ jobs:
|
||||
|
||||
- name: Abort if PR Merge SHA has Changed
|
||||
uses: actions/github-script@v7
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != inputs.pull_request_current_merge_sha
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != github.sha
|
||||
with:
|
||||
script: |
|
||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
@@ -393,7 +390,7 @@ jobs:
|
||||
|
||||
- name: Abort if PR Merge SHA has Changed
|
||||
uses: actions/github-script@v7
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != inputs.pull_request_current_merge_sha
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != github.sha
|
||||
with:
|
||||
script: |
|
||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
@@ -541,7 +538,7 @@ jobs:
|
||||
|
||||
- name: Abort if PR Merge SHA has Changed
|
||||
uses: actions/github-script@v7
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != inputs.pull_request_current_merge_sha
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != github.sha
|
||||
with:
|
||||
script: |
|
||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
@@ -616,7 +613,7 @@ jobs:
|
||||
|
||||
- name: Abort if PR Merge SHA has Changed
|
||||
uses: actions/github-script@v7
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != inputs.pull_request_current_merge_sha
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != github.sha
|
||||
with:
|
||||
script: |
|
||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
@@ -706,7 +703,7 @@ jobs:
|
||||
|
||||
- name: Abort if PR Merge SHA has Changed
|
||||
uses: actions/github-script@v7
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != inputs.pull_request_current_merge_sha
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != github.sha
|
||||
with:
|
||||
script: |
|
||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
@@ -864,7 +861,7 @@ jobs:
|
||||
|
||||
- name: Abort if PR Merge SHA has Changed
|
||||
uses: actions/github-script@v7
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != inputs.pull_request_current_merge_sha
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != github.sha
|
||||
with:
|
||||
script: |
|
||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
@@ -1112,7 +1109,7 @@ jobs:
|
||||
|
||||
- name: Abort if PR Merge SHA has Changed
|
||||
uses: actions/github-script@v7
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != inputs.pull_request_current_merge_sha
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != github.sha
|
||||
with:
|
||||
script: |
|
||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
@@ -1224,7 +1221,7 @@ jobs:
|
||||
|
||||
- name: Abort if PR Merge SHA has Changed
|
||||
uses: actions/github-script@v7
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != inputs.pull_request_current_merge_sha
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != github.sha
|
||||
with:
|
||||
script: |
|
||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
@@ -1272,7 +1269,7 @@ jobs:
|
||||
|
||||
- name: Abort if PR Merge SHA has Changed
|
||||
uses: actions/github-script@v7
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != inputs.pull_request_current_merge_sha
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != github.sha
|
||||
with:
|
||||
script: |
|
||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
@@ -1585,7 +1582,7 @@ jobs:
|
||||
|
||||
- name: Abort if PR Merge SHA has Changed
|
||||
uses: actions/github-script@v7
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != inputs.pull_request_current_merge_sha
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != github.sha
|
||||
with:
|
||||
script: |
|
||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
@@ -1708,7 +1705,7 @@ jobs:
|
||||
|
||||
- name: Abort if PR Merge SHA has Changed
|
||||
uses: actions/github-script@v7
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != inputs.pull_request_current_merge_sha
|
||||
if: github.event_name != 'push' && github.event_name != 'schedule' && steps.get-pr-sha.outputs.head_sha != github.sha
|
||||
with:
|
||||
script: |
|
||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
@@ -1886,15 +1883,15 @@ jobs:
|
||||
|
||||
- name: Update CI Check Run (Cancelled)
|
||||
if: cancelled()
|
||||
run: dotnet release_notes_bins/Tgstation.Server.ReleaseNotes.dll --ci-check ${{ github.event.inputs.pull_request_current_merge_sha }} ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }} Cancelled ${{ github.run_id }}
|
||||
run: dotnet release_notes_bins/Tgstation.Server.ReleaseNotes.dll --ci-check ${{ github.event.github.sha }} ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }} Cancelled ${{ github.run_id }}
|
||||
|
||||
- name: Update CI Check Run (Failure)
|
||||
if: (!cancelled() && failure())
|
||||
run: dotnet release_notes_bins/Tgstation.Server.ReleaseNotes.dll --ci-check ${{ github.event.inputs.pull_request_current_merge_sha }} ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }} Failure ${{ github.run_id }}
|
||||
run: dotnet release_notes_bins/Tgstation.Server.ReleaseNotes.dll --ci-check ${{ github.event.github.sha }} ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }} Failure ${{ github.run_id }}
|
||||
|
||||
- name: Update CI Check Run (Success)
|
||||
if: (!cancelled() && failure())
|
||||
run: dotnet release_notes_bins/Tgstation.Server.ReleaseNotes.dll --ci-check ${{ github.event.inputs.pull_request_current_merge_sha }} ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }} Success ${{ github.run_id }}
|
||||
run: dotnet release_notes_bins/Tgstation.Server.ReleaseNotes.dll --ci-check ${{ github.event.github.sha }} ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }} Success ${{ github.run_id }}
|
||||
|
||||
- name: Fail Job if Prerequisites Failed
|
||||
if: failure()
|
||||
|
||||
@@ -82,10 +82,6 @@ jobs:
|
||||
- name: Build ReleaseNotes
|
||||
run: dotnet publish -c Release -p:TGS_HOST_NO_WEBPANEL=true -o release_notes_bins tools/Tgstation.Server.ReleaseNotes/Tgstation.Server.ReleaseNotes.csproj
|
||||
|
||||
- name: Read Current SHA
|
||||
id: get-pr-sha
|
||||
run: echo "head_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate Temporary Branch to Reference Merge
|
||||
run: |
|
||||
git checkout -b ${{ github.event.pull_request.number }}-merge
|
||||
@@ -104,11 +100,10 @@ jobs:
|
||||
workflow-inputs: |
|
||||
{
|
||||
"pull_request_number": "${{ github.event.pull_request.number }}"
|
||||
"pull_request_current_merge_sha": "${{ steps.get-pr-sha.outputs.head_sha }}"
|
||||
}
|
||||
|
||||
- name: Set CI Check Run (Pending)
|
||||
run: dotnet release_notes_bins/Tgstation.Server.ReleaseNotes.dll --ci-check ${{ steps.get-pr-sha.outputs.head_sha }} ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }} Pending ${{ steps.dispatch.outputs.run-id }}
|
||||
run: dotnet release_notes_bins/Tgstation.Server.ReleaseNotes.dll --ci-check ${{ github.sha }} ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }} Pending ${{ steps.dispatch.outputs.run-id }}
|
||||
|
||||
- name: Delete Temporary Branch
|
||||
if: always()
|
||||
|
||||
Reference in New Issue
Block a user