Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Lint and unit tests require a token sometimes for getting required binaries #149

Merged
merged 1 commit into from
Dec 13, 2024
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
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ benefits from improvements made here (e.g. new tasks or improvements in the
tasks).

If you are new to Task, you may want to check out the following resources:

- [Installation instructions](https://taskfile.dev/installation/)
- Instructions to [configure completions](https://taskfile.dev/installation/#setup-completions)
- [Integrations](https://taskfile.dev/integrations/) with e.g. Visual Studio Code, Sublime and IntelliJ.
Expand All @@ -51,9 +52,9 @@ below, where the `GCI_SECTIONS` variable is overridden, for how to do this.

The following variables can be overridden:

| Variable | Description |
| :------------------- | :------------------------------------------------------------------------------------------------------------------------------ |
| `GCI_SECTION` | Define how `gci` processes inputs (see the [gci README](https://github.com/daixiang0/gci?tab=readme-ov-file#usage) for details) | |
| Variable | Description |
| :------------ | :------------------------------------------------------------------------------------------------------------------------------ | --- |
| `GCI_SECTION` | Define how `gci` processes inputs (see the [gci README](https://github.com/daixiang0/gci?tab=readme-ov-file#usage) for details) | |

## Usage

Expand Down Expand Up @@ -95,14 +96,13 @@ If you want to override one of the variables in our Taskfile, you'll have adjust

```yml
---
...

---
includes:
remote:
taskfile: >-
{{.REMOTE_URL}}/{{.REMOTE_URL_REPO}}/{{.REMOTE_URL_REF}}/Taskfile.yml
vars:
GCI_SECTIONS: '-s standard -s default -s alias'
GCI_SECTIONS: "-s standard -s default -s alias"
```

### GitHub
Expand Down Expand Up @@ -146,16 +146,17 @@ and a [.golangci.yml](https://golangci-lint.run/usage/configuration/).

<!-- markdownlint-disable MD013 -->

| Option | Default | Required | Description |
| :--------------------------- | :------ | -------- | :--------------------------------------------------------------------------------------------- |
| code-coverage-expected | x | | |
| gci | x | | Check for 'incorrect import order'. If failed then instructions are shown to resolve the issue |
| golang-unit-tests-exclusions | x | | |
| task-version | x | | |
| testing-type | | | |
| token | | | GitHub token that is required to pull cached Trivy DB images |
| trivy-action-db | x | | Replace this with a cached image to prevent bump into pull rate limiting issues |
| trivy-action-java-db | x | | Replace this with a cached image to prevent bump into pull rate limiting issues |
| Option | Default | Required |
| :---------------------------------------------- | :------ | -------- |
| code-coverage-expected | x | |
| gci | x | |
| github-token-for-downloading-private-go-modules | | |
| golang-unit-tests-exclusions | x | |
| task-version | x | |
| testing-type | | |
| token | | |
| trivy-action-db | x | |
| trivy-action-java-db | x | |

Note: If an **x** is registered in the Default column, refer to the
[action.yml](action.yml) for the corresponding value.
Expand Down
13 changes: 9 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ inputs:
default: "true"
description: |
Whether to check gci. Disable if the project provides an alternative way.
github-token-for-downloading-private-go-modules:
description: |
Whether private go modules have to be downloaded.
golang-unit-tests-exclusions:
default: " "
description: |
Expand Down Expand Up @@ -55,6 +58,10 @@ runs:
major_version=$(echo "${{ inputs.task-version }}" | sed -E 's/^v([0-9]+).*/\1/')
go install github.com/go-task/task/v${major_version}/cmd/task@${{ inputs.task-version }}
fi
- run: |
git config --global url.https://${{ inputs.github-token-for-downloading-private-go-modules }}@github.com/.insteadOf https://github.com/
shell: bash
if: ${{ inputs.github-token-for-downloading-private-go-modules != '' }}
# yamllint enable rule:line-length
#
# Verify downloaded dependencies.
Expand All @@ -77,8 +84,6 @@ runs:
- name: gci
if: inputs.gci == 'true' && inputs.testing-type == 'lint'
shell: bash
env:
TASK_X_REMOTE_TASKFILES: 1
run: |
task remote:gci --yes
#
Expand Down Expand Up @@ -141,7 +146,7 @@ runs:
if: inputs.testing-type == 'lint'
shell: bash
env:
TASK_X_REMOTE_TASKFILES: 1
GITHUB_TOKEN: ${{ inputs.token }}
run: |
task remote:golangci-lint --yes
#
Expand All @@ -151,7 +156,7 @@ runs:
if: inputs.testing-type == 'unit'
shell: bash
env:
TASK_X_REMOTE_TASKFILES: 1
GITHUB_TOKEN: ${{ inputs.token }}
run: |
task remote:test --yes
#
Expand Down