Skip to content

Commit 96cb9c0

Browse files
authored
GHA fix checkout-ref & Gradle Wrapper (#130)
* fix checkout-ref - don't fall back to the main branch! Use the ref of the event that triggered the action (`github.ref`) * fix gradle wrapper * update gradle wrapper again??
1 parent 1f7d410 commit 96cb9c0

File tree

7 files changed

+19
-14
lines changed

7 files changed

+19
-14
lines changed

.gitattributes

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Common settings that generally should always be used with your language specific settings
1+
# https://help.github.com/articles/dealing-with-line-endings/
2+
# https://github.com/alexkaratarakis/gitattributes
23

3-
# Auto detect text files and perform LF normalization
4-
* text eol=lf
4+
* text=auto
55

66
# The above will handle all files NOT found below
77

@@ -44,12 +44,14 @@
4444
*.cmd text eol=crlf
4545
*.ps1 text eol=crlf
4646

47-
48-
# JVM sources
49-
*.java text diff=java
50-
*.gradle text diff=java
51-
*.kt text diff=java
52-
*.kts text diff=java
47+
# JVM
48+
*.java text diff=java
49+
*.gradle text diff=java
50+
*.java text diff=java
51+
*.kt text diff=kotlin
52+
*.kts text diff=kotlin
53+
*.properties text
54+
*.jar binary
5355

5456
# Text files where line endings should be preserved
5557
*.patch -text

.github/workflows/run_gradle_task.yml

+1-1
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

+2-1
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

+1-1
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

+2
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

+2-2
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 }}

gradle/wrapper/gradle-wrapper.jar

1 Byte
Binary file not shown.

0 commit comments

Comments
 (0)