Skip to content

Commit 4907cdf

Browse files
jthegedusexKAZUu
andauthored
feat: update asdf repo if it exists (#539)
Co-authored-by: Sakamoto, Kazunori <[email protected]>
1 parent ea2f7d9 commit 4907cdf

File tree

9 files changed

+164
-82
lines changed

9 files changed

+164
-82
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,4 @@ jobs:
3636
shell: bash
3737
run: |
3838
yarn build
39-
if [ "$(git status --porcelain | wc -l)" -gt "0" ]; then
40-
echo "Detected uncommitted changes after build. See status below:"
41-
git diff
42-
exit 1
43-
fi
39+
yarn build:check_uncommitted_changes

.github/workflows/test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,36 @@ jobs:
2424
echo PATH="${PATH}"
2525
asdf --version
2626
27+
asdf_updates_clone_if_installed:
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
os: ["macos-latest", "ubuntu-latest"]
32+
runs-on: ${{ matrix.os }}
33+
steps:
34+
- uses: actions/checkout@v3
35+
- name: "Setup: should clone repo"
36+
uses: ./setup
37+
- run: asdf version
38+
- name:
39+
"Simulate self-hosted runner and remove /home/runner/.asdf/bin/asdf
40+
after setup (:shrug:)"
41+
if: ${{ matrix.os == 'ubuntu-latest' }}
42+
run: |
43+
rm -rf /home/runner/.asdf/bin/asdf
44+
- name:
45+
"Simulate self-hosted runner and remove /Users/runner/.asdf/bin/asdf
46+
after setup (:shrug:)"
47+
if: ${{ matrix.os == 'macos-latest' }}
48+
run: |
49+
rm -rf /Users/runner/.asdf/bin/asdf
50+
- name: "Setup: should update repo"
51+
uses: ./setup
52+
# NB: how is it that the hosted runners get to this point in the code without ~/.asdf/bin/asdf
53+
# the below execution fails because the checkout doesn't seem to fix the rm -rf.
54+
# Comment out for now & trust in the OP of #394
55+
# - run: asdf version
56+
2757
plugin_is_tested:
2858
strategy:
2959
fail-fast: false

install/main.js

Lines changed: 28 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lefthook.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ pre-push:
44
run: yarn run lint
55
format:
66
run: yarn fmt:check
7+
check_uncommitted_build_changes:
8+
run: yarn build:check_uncommitted_changes
79

810
pre-commit:
911
commands:

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"fmt:check": "prettier --check .",
1212
"typecheck": "tsc",
1313
"lint": "eslint \"**/*.ts\" --cache",
14-
"build": "esbuild src/install/main.ts src/plugin-test/main.ts src/plugins-add/main.ts src/setup/main.ts --bundle --outdir=. --target=node16 --platform=node"
14+
"build": "esbuild src/install/main.ts src/plugin-test/main.ts src/plugins-add/main.ts src/setup/main.ts --bundle --outdir=. --target=node16 --platform=node",
15+
"build:check_uncommitted_changes": "bash -c 'if [ $(git status --porcelain | grep --extended-regexp \"src|install|plugin-test|plugins-add\" | wc -l) -gt 0 ]; then printf \"* %s\\n\" \"Detected uncommitted changes after build. See status below:\"; git diff; exit 1; fi'"
1516
},
1617
"dependencies": {
1718
"@actions/core": "^1.10.0",

plugin-test/main.js

Lines changed: 25 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins-add/main.js

Lines changed: 28 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)