Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/minimal-crates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,27 @@ on:
crypto backend of rustls.
type: "boolean"
default: false
secrets:
GIT_TOKEN:
description: |
Token for private git dependencies on github.com.
required: false
workflow_dispatch:

concurrency:
group: min-crates-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
# Every job fetches github.com git dependencies with GIT_TOKEN, if given.
# The empty credential.helper stops git from storing the token after a
# fetch: macOS osxkeychain blocks during actions/checkout.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what this line is saying, same in the PR description.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mac os was bugging out because it has its os keychain thing which intervenes before things can proceed and unless set will just hang for input. This just works around it.

CARGO_NET_GIT_FETCH_WITH_CLI: "true"
GIT_CONFIG_COUNT: ${{ secrets.GIT_TOKEN != '' && '2' || '0' }}
GIT_CONFIG_KEY_0: url.https://x-access-token:${{ secrets.GIT_TOKEN }}@github.com/.insteadOf
GIT_CONFIG_VALUE_0: https://github.com/
GIT_CONFIG_KEY_1: credential.helper
GIT_CONFIG_VALUE_1: ""
RUST_BACKTRACE: 1
RUSTC_WRAPPER: "sccache"
SCCACHE_GHA_ENABLED: "true"
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ jobs:
uses: "n0-computer/workflows/.github/workflows/minimal-crates.yaml@main"
```

### Private git dependencies

Every shared workflow takes an optional `GIT_TOKEN` secret. All its
jobs fetch git dependencies from github.com with it, so a caller can
depend on a private repository:

```yaml
secrets:
GIT_TOKEN: ${{ secrets.MY_PRIVATE_REPO_TOKEN }}
```

A fine-grained token with read-only Contents access to the private
repository is enough. A new shared workflow must take the secret too:
copy its `secrets` and `env` entries from `minimal-crates.yaml`.

### Editing a shared workflow

- Start editing a shared workflow in a branch, e.g. `username/branch_name`.
Expand Down