Skip to content

Commit e9b3ae9

Browse files
committed
fix checkout-ref - don't fall back to the main branch! Use the ref of the event that triggered the action (github.ref)
1 parent 1f7d410 commit e9b3ae9

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

.github/workflows/run_gradle_task.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
- name: Checkout the repo
5959
uses: actions/checkout@v3
6060
with:
61-
ref: ${{ inputs.checkout-ref || github.event.repository.default_branch }}
61+
ref: ${{ inputs.checkout-ref || github.ref }}
6262

6363
- name: Validate Gradle Wrapper
6464
uses: gradle/wrapper-validation-action@v1

.github/workflows/run_publish_maven.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ permissions:
3030
jobs:
3131

3232
sonatype-release:
33+
if: github.ref == 'refs/heads/main'
3334
permissions:
3435
contents: read
3536
packages: write
@@ -40,4 +41,4 @@ jobs:
4041
runs-on: macos-latest # only macOS supports building all Kotlin targets
4142
gradle-task: >-
4243
publishAllPublicationsToSonatypeReleaseRepository --stacktrace --no-configuration-cache --no-parallel
43-
checkout-ref: ${{ inputs.checkout-ref || github.event.repository.default_branch }}
44+
checkout-ref: ${{ inputs.checkout-ref }}

.github/workflows/run_publish_site.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Checkout the repo
3030
uses: actions/checkout@v3
3131
with:
32-
ref: ${{ inputs.checkout-ref || github.event.repository.default_branch }}
32+
ref: ${{ inputs.checkout-ref || github.ref }}
3333

3434
- name: Validate Gradle Wrapper
3535
uses: gradle/wrapper-validation-action@v1

.github/workflows/run_tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
name: Tests
22

3+
34
on:
45
workflow_dispatch:
56
workflow_call:
67

8+
79
concurrency:
810
group: "Tests: ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
911
cancel-in-progress: true

.github/workflows/workflow_release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
contents: write
3838
packages: write
3939
with:
40-
checkout-ref: ${{ inputs.checkout-ref || github.event.repository.default_branch }}
40+
checkout-ref: ${{ inputs.checkout-ref }}
4141

4242
publish-site:
4343
needs: tests
@@ -51,4 +51,4 @@ jobs:
5151
packages: write
5252
pages: write # to deploy to Pages
5353
with:
54-
checkout-ref: ${{ inputs.checkout-ref || github.event.repository.default_branch }}
54+
checkout-ref: ${{ inputs.checkout-ref }}

0 commit comments

Comments
 (0)