Skip to content

Commit 0d52fd1

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 0d52fd1

File tree

5 files changed

+13
-26
lines changed

5 files changed

+13
-26
lines changed

.github/workflows/run_gradle_task.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
required: true
1212
type: string
1313
runs-on:
14-
description: "OS to run the task on"
14+
description: "OSes to run the task on"
1515
required: true
1616
type: string
1717
checkout-ref:
@@ -25,7 +25,7 @@ on:
2525
required: true
2626
type: string
2727
runs-on:
28-
description: "OS to run the task on"
28+
description: "OSes to run the task on"
2929
required: true
3030
type: string
3131
checkout-ref:
@@ -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: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,19 @@ jobs:
2929
- name: Checkout the repo
3030
uses: actions/checkout@v3
3131
with:
32-
ref: ${{ inputs.checkout-ref || github.event.repository.default_branch }}
33-
34-
- name: Validate Gradle Wrapper
35-
uses: gradle/wrapper-validation-action@v1
32+
ref: ${{ inputs.checkout-ref || github.ref }}
3633

3734
- name: Setup JDK
3835
uses: actions/setup-java@v3
3936
with:
4037
distribution: temurin
4138
java-version: 11
4239

43-
- name: Cache NPM
44-
uses: actions/cache@v3
45-
env:
46-
cache-name: cache-npm
47-
with:
48-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
49-
path: |
50-
./site/node_modules
51-
restore-keys: |
52-
${{ runner.os }}-build-${{ env.cache-name }}-
53-
${{ runner.os }}-build-
54-
${{ runner.os }}-
55-
56-
- name: docusaurus build
57-
uses: gradle/gradle-build-action@v2
40+
- uses: gradle/gradle-build-action@v2
5841
with:
5942
gradle-home-cache-cleanup: true
60-
arguments: docusaurusBuild
43+
arguments: |
44+
:modules:docs:dokkatooGenerate
6145
6246
- uses: actions/upload-pages-artifact@v2
6347
with:

.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)