Skip to content

Commit 4a74600

Browse files
committed
Fix, mint run latest version instead of mintfile
1 parent 88d5057 commit 4a74600

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

Actions/Comment/action.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,12 @@ runs:
2828
with:
2929
swift-version: 5.10.0
3030
- name: Create Mintfile
31-
run: echo Wei18/GitHubSwiftActions@${{ inputs.action_ref }} > ${{ github.action_path }}/Mintfile
31+
run: echo Wei18/GitHubSwiftActions@${{ inputs.action_ref }} > Mintfile
3232
shell: bash
3333
- name: Setup Mint
3434
uses: irgaly/setup-mint@v1
3535
with:
3636
cache-prefix: GitHubSwiftActions
37-
mint-directory: ${{ github.action_path }}
3837
mint-executable-directory: ~/.mint/bin
3938
- env:
4039
ACTION_REF: ${{ inputs.action_ref }}
@@ -47,4 +46,7 @@ runs:
4746
name: Run Comment
4847
run: ~/.mint/bin/mint run Wei18/GitHubSwiftActions Comment
4948
shell: bash
49+
- name: Create Mintfile
50+
run: rm Mintfile
51+
shell: bash
5052
using: composite

Actions/Release/action.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@ runs:
2525
with:
2626
swift-version: 5.10.0
2727
- name: Create Mintfile
28-
run: echo Wei18/GitHubSwiftActions@${{ inputs.action_ref }} > ${{ github.action_path }}/Mintfile
28+
run: echo Wei18/GitHubSwiftActions@${{ inputs.action_ref }} > Mintfile
2929
shell: bash
3030
- name: Setup Mint
3131
uses: irgaly/setup-mint@v1
3232
with:
3333
cache-prefix: GitHubSwiftActions
34-
mint-directory: ${{ github.action_path }}
3534
mint-executable-directory: ~/.mint/bin
3635
- env:
3736
ACTION_REF: ${{ inputs.action_ref }}
@@ -43,4 +42,7 @@ runs:
4342
name: Run Release
4443
run: ~/.mint/bin/mint run Wei18/GitHubSwiftActions Release
4544
shell: bash
45+
- name: Create Mintfile
46+
run: rm Mintfile
47+
shell: bash
4648
using: composite

Sources/YamlWriter/CLIYamlBuilder.swift

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ struct CLIYamlBuilder {
3232
]
3333
}
3434

35-
inputs.merge(SetUpActionBuilder().buildInputs()) { _, new in new }
35+
let factory = SetUpActionFactory()
36+
inputs.merge(factory.buildInputs()) { _, new in new }
3637

3738
let envDict = inputs.keys.reduce(into: [:]) { partialResult, value in
3839
partialResult[value.uppercased()] = "${{ inputs.\(value) }}"
@@ -48,14 +49,16 @@ struct CLIYamlBuilder {
4849
"inputs": inputs,
4950
"runs": [
5051
"using": "composite",
51-
"steps": SetUpActionBuilder().buildSteps() + [
52+
"steps": factory.buildSteps() +
53+
[
5254
[
5355
"name": "Run \(name)",
5456
"run": "~/.mint/bin/mint run \(repo) \(name)",
5557
"env": envDict,
5658
"shell": "bash",
5759
],
58-
],
60+
] +
61+
factory.buildPostSteps()
5962
],
6063
]
6164

@@ -64,7 +67,7 @@ struct CLIYamlBuilder {
6467
}
6568
}
6669

67-
private struct SetUpActionBuilder {
70+
private struct SetUpActionFactory {
6871

6972
/// Workaround: https://github.com/actions/runner/issues/2473#issuecomment-1776051383/
7073
func buildInputs() -> [String: Any] {
@@ -87,18 +90,27 @@ private struct SetUpActionBuilder {
8790
],
8891
[
8992
"name": "Create Mintfile",
90-
"run": "echo \(content) > ${{ github.action_path }}/Mintfile",
93+
"run": "echo \(content) > Mintfile",
9194
"shell": "bash",
9295
],
9396
[
9497
"name": "Setup Mint",
9598
"uses": "irgaly/setup-mint@v1",
9699
"with": [
97-
"mint-directory": "${{ github.action_path }}",
98100
"mint-executable-directory": "~/.mint/bin",
99101
"cache-prefix": "GitHubSwiftActions",
100102
],
103+
],
104+
]
105+
return action
106+
}
101107

108+
func buildPostSteps() -> [[String: Any]] {
109+
let action: [[String: Any]] = [
110+
[
111+
"name": "Create Mintfile",
112+
"run": "rm Mintfile",
113+
"shell": "bash",
102114
],
103115
]
104116
return action

0 commit comments

Comments
 (0)