fix: pass ref in pr comment workflow (#2777)
Co-authored-by: Michael Neale <michael.neale@gmail.com>
This commit is contained in:
@@ -21,6 +21,10 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
default: true
|
default: true
|
||||||
type: boolean
|
type: boolean
|
||||||
|
ref:
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
default: 'refs/heads/main'
|
||||||
secrets:
|
secrets:
|
||||||
CERTIFICATE_OSX_APPLICATION:
|
CERTIFICATE_OSX_APPLICATION:
|
||||||
description: 'Certificate for macOS application signing'
|
description: 'Certificate for macOS application signing'
|
||||||
@@ -77,6 +81,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||||
|
with:
|
||||||
|
ref: ${{ inputs.ref }}
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
# Update versions before build
|
# Update versions before build
|
||||||
- name: Update versions
|
- name: Update versions
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
WINDOWS_CERTIFICATE_PASSWORD:
|
WINDOWS_CERTIFICATE_PASSWORD:
|
||||||
required: false
|
required: false
|
||||||
|
ref:
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
default: 'refs/heads/main'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-desktop-windows:
|
build-desktop-windows:
|
||||||
@@ -27,6 +31,9 @@ jobs:
|
|||||||
# 1) Check out source
|
# 1) Check out source
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
|
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
|
||||||
|
with:
|
||||||
|
ref: ${{ inputs.ref }}
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
# 2) Set up Node.js
|
# 2) Set up Node.js
|
||||||
- name: Set up Node.js
|
- name: Set up Node.js
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ jobs:
|
|||||||
continue: ${{ steps.command.outputs.continue || github.event_name == 'workflow_dispatch' }}
|
continue: ${{ steps.command.outputs.continue || github.event_name == 'workflow_dispatch' }}
|
||||||
# Cannot use github.event.pull_request.number since the trigger is 'issue_comment'
|
# Cannot use github.event.pull_request.number since the trigger is 'issue_comment'
|
||||||
pr_number: ${{ steps.command.outputs.issue_number || github.event.inputs.pr_number }}
|
pr_number: ${{ steps.command.outputs.issue_number || github.event.inputs.pr_number }}
|
||||||
|
head_sha: ${{ steps.set_head_sha.outputs.head_sha || github.sha }}
|
||||||
steps:
|
steps:
|
||||||
- if: ${{ github.event_name == 'issue_comment' }}
|
- if: ${{ github.event_name == 'issue_comment' }}
|
||||||
uses: github/command@319d5236cc34ed2cb72a47c058a363db0b628ebe # pin@v1.3.0
|
uses: github/command@319d5236cc34ed2cb72a47c058a363db0b628ebe # pin@v1.3.0
|
||||||
@@ -40,6 +41,20 @@ jobs:
|
|||||||
reaction: "eyes"
|
reaction: "eyes"
|
||||||
allowed_contexts: pull_request
|
allowed_contexts: pull_request
|
||||||
|
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
|
||||||
|
|
||||||
|
- name: Get PR head SHA with gh
|
||||||
|
id: set_head_sha
|
||||||
|
run: |
|
||||||
|
echo "Get PR head SHA with gh"
|
||||||
|
HEAD_SHA=$(gh pr view "$ISSUE_NUMBER" --json headRefOid -q .headRefOid)
|
||||||
|
echo "head_sha=$HEAD_SHA" >> $GITHUB_OUTPUT
|
||||||
|
echo "head_sha=$HEAD_SHA"
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
ISSUE_NUMBER: ${{ steps.command.outputs.issue_number }}
|
||||||
|
|
||||||
bundle-desktop-intel:
|
bundle-desktop-intel:
|
||||||
# Only run this if ".bundle-intel" command is detected.
|
# Only run this if ".bundle-intel" command is detected.
|
||||||
needs: [trigger-on-command]
|
needs: [trigger-on-command]
|
||||||
@@ -47,6 +62,7 @@ jobs:
|
|||||||
uses: ./.github/workflows/bundle-desktop-intel.yml
|
uses: ./.github/workflows/bundle-desktop-intel.yml
|
||||||
with:
|
with:
|
||||||
signing: true
|
signing: true
|
||||||
|
ref: ${{ needs.trigger-on-command.outputs.head_sha }}
|
||||||
secrets:
|
secrets:
|
||||||
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
|
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
|
||||||
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
|
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ jobs:
|
|||||||
continue: ${{ steps.command.outputs.continue || github.event_name == 'workflow_dispatch' }}
|
continue: ${{ steps.command.outputs.continue || github.event_name == 'workflow_dispatch' }}
|
||||||
# Cannot use github.event.pull_request.number since the trigger is 'issue_comment'
|
# Cannot use github.event.pull_request.number since the trigger is 'issue_comment'
|
||||||
pr_number: ${{ steps.command.outputs.issue_number || github.event.inputs.pr_number }}
|
pr_number: ${{ steps.command.outputs.issue_number || github.event.inputs.pr_number }}
|
||||||
|
head_sha: ${{ steps.set_head_sha.outputs.head_sha || github.sha }}
|
||||||
steps:
|
steps:
|
||||||
- if: ${{ github.event_name == 'issue_comment' }}
|
- if: ${{ github.event_name == 'issue_comment' }}
|
||||||
uses: github/command@319d5236cc34ed2cb72a47c058a363db0b628ebe # pin@v1.3.0
|
uses: github/command@319d5236cc34ed2cb72a47c058a363db0b628ebe # pin@v1.3.0
|
||||||
@@ -40,6 +41,20 @@ jobs:
|
|||||||
reaction: "eyes"
|
reaction: "eyes"
|
||||||
allowed_contexts: pull_request
|
allowed_contexts: pull_request
|
||||||
|
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
|
||||||
|
|
||||||
|
- name: Get PR head SHA with gh
|
||||||
|
id: set_head_sha
|
||||||
|
run: |
|
||||||
|
echo "Get PR head SHA with gh"
|
||||||
|
HEAD_SHA=$(gh pr view "$ISSUE_NUMBER" --json headRefOid -q .headRefOid)
|
||||||
|
echo "head_sha=$HEAD_SHA" >> $GITHUB_OUTPUT
|
||||||
|
echo "head_sha=$HEAD_SHA"
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
ISSUE_NUMBER: ${{ steps.command.outputs.issue_number }}
|
||||||
|
|
||||||
bundle-desktop-windows:
|
bundle-desktop-windows:
|
||||||
# Only run this if ".bundle-windows" command is detected.
|
# Only run this if ".bundle-windows" command is detected.
|
||||||
needs: [trigger-on-command]
|
needs: [trigger-on-command]
|
||||||
@@ -47,6 +62,7 @@ jobs:
|
|||||||
uses: ./.github/workflows/bundle-desktop-windows.yml
|
uses: ./.github/workflows/bundle-desktop-windows.yml
|
||||||
with:
|
with:
|
||||||
signing: false # false for now as we don't have a cert yet
|
signing: false # false for now as we don't have a cert yet
|
||||||
|
ref: ${{ needs.trigger-on-command.outputs.head_sha }}
|
||||||
secrets:
|
secrets:
|
||||||
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
|
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
|
||||||
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
|
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
name: Trigger Build CLI
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
trigger-build-cli:
|
|
||||||
uses: ./.github/workflows/build-cli.yml
|
|
||||||
with:
|
|
||||||
ref: ${{ github.sha }}
|
|
||||||
Reference in New Issue
Block a user