Skip to content

Commit

Permalink
V4 dev with nsc git-checkout update-submodules and --dissociate (#3)
Browse files Browse the repository at this point in the history
Most v4 changes should be here:
- Update @babel/traverse and braces
- Add --dissociate
- Use nsc for submodule checkout
- Make CI job not fail on pull requests
   (Compare gh-action,ref:main <-> ns-action,ref:main
    and gh-action,ref: <-> ns-action,ref:
    instead of gh-action,ref: <-> ns-action,ref:main
    This should work well on PRs and still have regression
    test coverage for NSL-2974.)
  • Loading branch information
pavolmarko authored Jul 5, 2024
1 parent 1d33a43 commit e10c48a
Showing 6 changed files with 204 additions and 201 deletions.
32 changes: 26 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -16,24 +16,44 @@ jobs:
runs-on: [nscloud-ubuntu-22.04-staging-amd64-2x4-with-cache, nscloud-git-mirror-5gb]

steps:
- name: Github Checkout
- name: Github Checkout current
uses: actions/checkout@v4
- name: Namespace Checkout
- name: Namespace Checkout Current
uses: ./ # Uses an action in the root directory
with:
path: nscloud
ref: main
path: nscloud-current
- name: Compare current
run: |
if cmp --silent -- action.yml nscloud-current/action.yml; then
echo "files contents are identical"
else
echo "files differ:"
diff action.yml nscloud-current/action.yml
exit 1
fi
- name: Github Checkout main
uses: actions/checkout@v4
with:
path: github-main
- name: Namespace Checkout main
uses: ./ # Uses an action in the root directory
with:
path: nscloud-main
- name: Compare main
run: |
if cmp --silent -- action.yml nscloud/action.yml; then
if cmp --silent -- github-main/action.yml nscloud-main/action.yml; then
echo "files contents are identical"
else
echo "files differ:"
diff action.yml nscloud/action.yml
diff github-main/action.yml nscloud-main/action.yml
exit 1
fi
- uses: ruby/action-slack@v3.2.1
with:
payload: |
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Namespace Cloud optimized Checkout Action

This action is a specialized and optimized version of [`actions/checkout`](https://github.com/actions/checkout) for Namespace Runners.
It expects to run in a Namespace Runner and it will fail for otherwise. It also expects that the _git mirror_ feature is enabled in
the Namespace runner.
It expects to run in a Namespace Runner and it will fail for otherwise. It also expects that the _git mirror_ feature is enabled in
the Namespace runner.

This action uses [Namespace Cache Volumes](https://namespace.so/docs/concepts/storage) to store a mirror of your git repository, and uses it speed up the checkout process.

@@ -26,7 +26,7 @@ steps:
runs-on: [nscloud-ubuntu-22.04-amd64-2x4-with-cache, nscloud-git-mirror-5gb]
steps:
- name: Checkout
uses: namespacelabs/nscloud-checkout-action@v2
uses: namespacelabs/nscloud-checkout-action@v4
with:
# Repository name with owner. For example, actions/checkout
# Default: ${{ github.repository }}
@@ -63,6 +63,17 @@ steps:
#
# Default: false
submodules: ''

dissociate: ''
# Dissociate the checkout (and optionally submodules, if any) from the mirror:
# `true` to dissociate the main repository or 'recursive' to dissociate the main
# repository and all submodules.
# Dissociate instructs git to copy all git objects to a checkout directory. After
# this, the checkout has no link to the Namespace Git mirror.
# This allows docker-based GitHub actions to perform git operations on the checkout,
# such as git status.
#
# Default: false
```

## Development
11 changes: 9 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ inputs:

fetch-depth:
description: 'Number of commits to fetch. 0 indicates all history for all branches and tags.'
default: 1
default: "1"

path:
description: 'Relative path under $GITHUB_WORKSPACE to place the repository'
@@ -42,7 +42,14 @@ inputs:
When the `ssh-key` input is not provided, SSH URLs beginning with `git@github.com:` are
converted to HTTPS.
default: false
default: "false"

dissociate:
description: >
Whether to dissociate the checkout (and submodules, if any) from the Namespace Git mirror:
`true` to dissociate the main checkout, `recursive` to dissociate the main checkout and
all submodules.
default: "false"

runs:
using: node20
46 changes: 31 additions & 15 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e10c48a

Please sign in to comment.