Skip to content

Commit

Permalink
Merge branch 'rhysd:main' into dev-expression
Browse files Browse the repository at this point in the history
  • Loading branch information
hugo-syn authored Oct 20, 2023
2 parents 6df960d + 1ed1a83 commit 340fcb1
Show file tree
Hide file tree
Showing 34 changed files with 727 additions and 223 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go: ['1.19', '1.20']
go: ['1.20', '1.21']
runs-on: ${{ matrix.os }}
steps:
- name: Install dependencies on macOS
Expand All @@ -34,16 +34,19 @@ jobs:
pip install pyflakes
pyflakes --version
if: ${{ matrix.os == 'windows-latest' }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- run: go test -v -race -coverprofile coverage.txt -covermode=atomic ./...
- run: go tool cover -func ./coverage.txt
# Check build without CGO
- run: go build ./cmd/actionlint
env:
# Note: -race requires cgo
CGO_ENABLED: 0
- run: go test -v -race -coverprofile coverage.txt -covermode=atomic ./...
- run: go tool cover -func ./coverage.txt
# Set -race for catching data races on dog fooding (#333)
- run: go build -race ./cmd/actionlint
- name: Dog fooding 🐶
run: |
echo "::add-matcher::.github/actionlint-matcher.json"
Expand All @@ -57,10 +60,10 @@ jobs:
name: Wasm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.21'
- uses: actions/setup-node@v3
with:
node-version: "lts/*"
Expand All @@ -79,10 +82,10 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.21'
- name: Check Go sources are formatted
run: |
diffs="$(gofmt -d ./*.go ./cmd/actionlint/*.go ./scripts/*/*.go ./playground/*.go)"
Expand All @@ -101,13 +104,13 @@ jobs:
name: Dockerfile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build image
id: image
uses: docker/build-push-action@v3
with:
build-args: |
GOLANG_VER=1.20
GOLANG_VER=1.21
push: false
- name: Test Docker image
run: docker container run
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
matrix:
language: ['go', 'javascript']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: github/codeql-action/init@v2
with:
config-file: ./.github/codeql/codeql-config.yaml
Expand All @@ -37,7 +37,7 @@ jobs:
if: ${{ matrix.language != 'go' }}
- uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.21'
if: ${{ matrix.language == 'go' }}
- name: Build Go sources
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/download.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: ./scripts/test-download-actionlint.bash
shell: bash
4 changes: 2 additions & 2 deletions .github/workflows/generate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.21'
- name: Check new release on GitHub
run: go run ./scripts/generate-popular-actions -d
- run: go generate
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/matcher.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
name: Test generate-actionlint-matcher
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.21'
- uses: actions/setup-node@v3
with:
node-version: "lts/*"
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
- run: gem install ronn
- run: ronn ./man/actionlint.1.ronn
- uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.21'
- uses: goreleaser/goreleaser-action@v4
with:
version: latest
Expand All @@ -29,7 +29,7 @@ jobs:
- name: Post-release download check
run: bash ./scripts/download-actionlint.bash "${GITHUB_REF#refs/tags/v}"
- name: Clone nested repository to make version bump commit
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ./tmp-actionlint-for-update-ver
ref: main
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Get tag name
id: tag
run: |
Expand All @@ -77,7 +77,7 @@ jobs:
with:
platforms: linux/amd64,linux/arm64
build-args: |
GOLANG_VER=1.20
GOLANG_VER=1.21
ACTIONLINT_VER=${{ steps.tag.outputs.name }}
push: true
tags: |
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
language: docker_image
types: ["yaml"]
files: ^\.github/workflows/
entry: rhysd/actionlint:1.6.25
entry: rhysd/actionlint:1.6.26
- id: actionlint-system
name: Lint GitHub Actions workflow files
description: Runs system-installed actionlint to lint GitHub Actions workflow files
Expand Down
103 changes: 100 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,99 @@
<a name="v1.6.26"></a>
# [v1.6.26](https://github.com/rhysd/actionlint/releases/tag/v1.6.26) - 18 Sep 2023

- Several template fields and template actions were added. All fields and actions are listed in [the document](https://github.com/rhysd/actionlint/blob/main/docs/usage.md#format-error-messages). Please read it for more details. ([#311](https://github.com/rhysd/actionlint/issues/311))
- By these additions, now actionlint can output the result in [the SARIF format](https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html). SARIF is a format for the output of static analysis tools used by [GitHub CodeQL](https://codeql.github.com/). [the example Go template](https://github.com/rhysd/actionlint/blob/main/testdata/format/sarif_template.txt) to format actionlint output in SARIF.
```sh
actionlint -format "$(cat /path/to/sarif_template.txt)" > output.json
```
- `allKinds` returns the kinds (lint rules) information as an array. You can include what lint rules are defined in the command output.
- `toPascalCase` converts snake case (`foo_bar`) or kebab case (`foo-bar`) into pascal case (`FooBar`).
- Report an error when the condition at `if:` is always evaluated to true. See [the check document](https://github.com/rhysd/actionlint/blob/main/docs/checks.md#if-cond-always-true) to know more details. ([#272](https://github.com/rhysd/actionlint/issues/272))
```yaml
# ERROR: All the following `if:` conditions are always evaluated to true
- run: echo 'Commit is pushed'
if: |
${{ github.event_name == 'push' }}
- run: echo 'Commit is pushed'
if: "${{ github.event_name == 'push' }} "
- run: echo 'Commit is pushed to main'
if: ${{ github.event_name == 'push' }} && ${{ github.ref_name == 'main' }}
```
- Fix actionlint didn't understand `${{ }}` placeholders in environment variable names. ([#312](https://github.com/rhysd/actionlint/issues/312))
```yaml
env:
"${{ steps.x.outputs.value }}": "..."
```
- Fix type of matrix row when some expression is assigned to it with `${{ }}` ([#285](https://github.com/rhysd/actionlint/issues/285))
```yaml
strategy:
matrix:
test:
# Matrix rows are assigned from JSON string
- ${{ fromJson(inputs.matrix) }}
steps:
- run: echo ${{ matrix.test.foo.bar }}
```
- Fix checking `exclude` of matrix was incorrect when some matrix row is dynamically constructed with `${{ }}`. ([#261](https://github.com/rhysd/actionlint/issues/261))
```yaml
strategy:
matrix:
build-type:
- debug
- ${{ fromJson(inputs.custom-build-type) }}
exclude:
# 'release' is not listed in 'build-type' row, but it should not be reported as error
# since the second row of 'build-type' is dynamically constructed with ${{ }}.
- build-type: release
```
- Fix checking `exclude` of matrix was incorrect when object is nested at row of the matrix. ([#249](https://github.com/rhysd/actionlint/issues/249))
```yaml
matrix:
os:
- name: Ubuntu
matrix: ubuntu
- name: Windows
matrix: windows
arch:
- name: ARM
matrix: arm
- name: Intel
matrix: intel
exclude:
# This should exclude { os: { name: Windows, matrix: windows }, arch: {name: ARM, matrix: arm } }
- os:
matrix: windows
arch:
matrix: arm
```
- Fix data race when `actionlint.yml` config file is used by multiple goroutines to check multiple workflow files. ([#333](https://github.com/rhysd/actionlint/issues/333))
- Check keys' case sensitivity. ([#302](https://github.com/rhysd/actionlint/issues/302))
```yaml
steps:
# ERROR: 'run:' is correct
- ruN: echo "hello"
```
- Add `number` as [input type of `workflow_dispatch` event](https://docs.github.com/en/actions/learn-github-actions/contexts#inputs-context). ([#316](https://github.com/rhysd/actionlint/issues/316))
- Check max number of inputs of `workflow_dispatch` event is 10.
- Check numbers at `timeout-minutes` and `max-parallel` are greater than zero.
- Add Go APIs to define a custom rule. Please read [the code example](https://pkg.go.dev/github.com/rhysd/actionlint/#example_Linter_yourOwnRule) to know the usage.
- Make some [`RuleBase`](https://pkg.go.dev/github.com/rhysd/actionlint#RuleBase) methods public which are useful to implement your own custom rule type. (thanks [@hugo-syn](https://github.com/hugo-syn), [#327](https://github.com/rhysd/actionlint/issues/327), [#331](https://github.com/rhysd/actionlint/issues/331))
- `OnRulesCreated` field is added to [`LinterOptions`](https://pkg.go.dev/github.com/rhysd/actionlint#LinterOptions) struct. You can modify applied rules with the hook (add your own rule, remove some rule, ...).
- Add `NewProject()` Go API to create a [`Project`](https://pkg.go.dev/github.com/rhysd/actionlint#Project) instance.
- Fix tests failed when sources are downloaded from `.tar.gz` link. ([#307](https://github.com/rhysd/actionlint/issues/307))
- Improve [the pre-commit document](https://github.com/rhysd/actionlint/blob/main/docs/usage.md#pre-commit) to explain all pre-commit hooks by this repository.
- Clarify the regular expression syntax of `-ignore` option is [RE2](https://github.com/google/re2/wiki/Syntax). ([#320](https://github.com/rhysd/actionlint/issues/320))
- Use ubuntu-latest runner to create winget release. (thanks [@sitiom](https://github.com/sitiom), [#308](https://github.com/rhysd/actionlint/issues/308))
- Update popular actions data set, available contexts, webhook types to the latest.
- Fix typo in `watch` webhook's types (thanks [@suzuki-shunsuke](https://github.com/suzuki-shunsuke), [#334](https://github.com/rhysd/actionlint/issues/334))
- Add `secret_source` property to [`github` context](https://docs.github.com/en/actions/learn-github-actions/contexts#github-context). (thanks [@asml-mdroogle](https://github.com/asml-mdroogle), [#339](https://github.com/rhysd/actionlint/issues/339))
- Many new major releases are added to the popular actions data set (including `actions/checkout@v4`).
- Use Go 1.21 to build release binaries.
- Update Go dependencies to the latest. (thanks [@harryzcy](https://github.com/harryzcy), [#322](https://github.com/rhysd/actionlint/issues/322))
[Changes][v1.6.26]
<a name="v1.6.25"></a>
# [v1.6.25](https://github.com/rhysd/actionlint/releases/tag/v1.6.25) - 15 Jun 2023
Expand All @@ -9,14 +105,14 @@
```
- Add support for macOS XL runners. `macos-latest-xl`, `macos-13-xl`, `macos-12-xl` labels are available at `runs-on:`. ([#299](https://github.com/rhysd/actionlint/issues/299), thanks [@woa7](https://github.com/woa7))
- Find Git project directory from `-stdin-filename` command line argument. Even if the workflow content is passed via stdin, actionlint can recognize reusable workflows depended by the workflow using file path passed at `-stdin-filename` argument. ([#283](https://github.com/rhysd/actionlint/issues/283))
- Fix order of errors is not deterministic when multiple errors happens at the same location (file name, line number, column number) when building actionlint with Go 1.20.
- Fix order of errors is not deterministic when multiple errors happen at the same location (file name, line number, column number). It happens only when building actionlint with Go 1.20 or later.
- Fix type name of `watch` webhook.
- Fix type of matrix row (property of `matrix` context) when `${{ }}` is used in the row value. ([#294](https://github.com/rhysd/actionlint/issues/294))
- Fix `go install ./...` doesn't work. ([#297](https://github.com/rhysd/actionlint/issues/297))
- Update `actionlint` pre-commit hook to use Go toolchain. Now pre-commit automatically installs `actionlint` command so you don't need to install it manually. Note that this hook requires pre-commit v3.0.0 or later. For those who don't have Go toolchain, the previous hook is maintained as `actionlint-system` hook. ([#301](https://github.com/rhysd/actionlint/issues/301), thanks [@Freed-Wu](https://github.com/Freed-Wu) and [@dokempf](https://github.com/dokempf))
- Update `actionlint` pre-commit hook to use Go toolchain. Now pre-commit automatically installs `actionlint` command so you don't need to install it manually. Note that this hook requires pre-commit v3.0.0 or later. For those who don't have Go toolchain, the previous hook is maintained as `actionlint-system` hook. Please read [the document](https://github.com/rhysd/actionlint/blob/main/docs/usage.md#pre-commit) to know the usage details. ([#301](https://github.com/rhysd/actionlint/issues/301), thanks [@Freed-Wu](https://github.com/Freed-Wu) and [@dokempf](https://github.com/dokempf))
- Update Go dependencies to the latest.
- Update npm dependencies for playground to the latest and fix optimizing Wasm binary with `wasm-opt`.
- Update popular actions data set. New major versions and new inputs of many popular actions are now supported like `sparse-checkout` of `actions/checkout`. ([#305](https://github.com/rhysd/actionlint/issues/305))
- Update popular actions data set. New major versions and new inputs of many popular actions are now supported like `sparse-checkout` input of `actions/checkout` action. ([#305](https://github.com/rhysd/actionlint/issues/305))
- Fix outdated document for Problem Matchers. ([#289](https://github.com/rhysd/actionlint/issues/289), thanks [@carlcsaposs-canonical](https://github.com/carlcsaposs-canonical))
- Fix outdated links in document for super-linter. ([#303](https://github.com/rhysd/actionlint/issues/303), thanks [@gmacario](https://github.com/gmacario))
- Automate releasing the Winget package with GitHub Actions. ([#276](https://github.com/rhysd/actionlint/issues/276), [#293](https://github.com/rhysd/actionlint/issues/293), thanks [@sitiom](https://github.com/sitiom))
Expand Down Expand Up @@ -1402,6 +1498,7 @@ See documentation for more details:
[Changes][v1.0.0]
[v1.6.26]: https://github.com/rhysd/actionlint/compare/v1.6.25...v1.6.26
[v1.6.25]: https://github.com/rhysd/actionlint/compare/v1.6.24...v1.6.25
[v1.6.24]: https://github.com/rhysd/actionlint/compare/v1.6.23...v1.6.24
[v1.6.23]: https://github.com/rhysd/actionlint/compare/v1.6.22...v1.6.23
Expand Down
30 changes: 15 additions & 15 deletions HomebrewFormula/actionlint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
class Actionlint < Formula
desc "Static checker for GitHub Actions workflow files"
homepage "https://github.com/rhysd/actionlint#readme"
version "1.6.25"
version "1.6.26"
license "MIT"

on_macos do
if Hardware::CPU.intel?
url "https://github.com/rhysd/actionlint/releases/download/v1.6.25/actionlint_1.6.25_darwin_amd64.tar.gz"
sha256 "30d69622ff9fbf564081515bf7d20538f2cb590150ef0c69fdcc56fa23fe85f1"
if Hardware::CPU.arm?
url "https://github.com/rhysd/actionlint/releases/download/v1.6.26/actionlint_1.6.26_darwin_arm64.tar.gz"
sha256 "5e131ab7de7ad051e1923b80d167aaa414734e97c720698c48778250e1dd2590"

def install
bin.install "actionlint"
man1.install "man/actionlint.1"
end
end
if Hardware::CPU.arm?
url "https://github.com/rhysd/actionlint/releases/download/v1.6.25/actionlint_1.6.25_darwin_arm64.tar.gz"
sha256 "9153ebe7be2a33c9047e60aeb0d8d7b831b22fe99bbea63d365500c68245d6df"
if Hardware::CPU.intel?
url "https://github.com/rhysd/actionlint/releases/download/v1.6.26/actionlint_1.6.26_darwin_amd64.tar.gz"
sha256 "bfa890e77a8508603c785af09a30bbab3a3255d291d8d27efc3f20ac8e303a8e"

def install
bin.install "actionlint"
Expand All @@ -31,26 +31,26 @@ def install

on_linux do
if Hardware::CPU.arm? && !Hardware::CPU.is_64_bit?
url "https://github.com/rhysd/actionlint/releases/download/v1.6.25/actionlint_1.6.25_linux_armv6.tar.gz"
sha256 "79180b0d572a4154965c0bcdb3ab3a37ca24b6d254192932ec7ca39128ceac5a"
url "https://github.com/rhysd/actionlint/releases/download/v1.6.26/actionlint_1.6.26_linux_armv6.tar.gz"
sha256 "1d6a1686ba14257d78131806d961ca79e599fd5fcfa09e6bdc1084a8ae7160ae"

def install
bin.install "actionlint"
man1.install "man/actionlint.1"
end
end
if Hardware::CPU.intel?
url "https://github.com/rhysd/actionlint/releases/download/v1.6.25/actionlint_1.6.25_linux_amd64.tar.gz"
sha256 "80a54660e73ad55a0818372bdaa0dced82eb86f618e6bf1621e73f099e61c027"
if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
url "https://github.com/rhysd/actionlint/releases/download/v1.6.26/actionlint_1.6.26_linux_arm64.tar.gz"
sha256 "a1056d85d614af4f6e5517ed2911dab2621b8e97c368c8b265328f9c22801648"

def install
bin.install "actionlint"
man1.install "man/actionlint.1"
end
end
if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
url "https://github.com/rhysd/actionlint/releases/download/v1.6.25/actionlint_1.6.25_linux_arm64.tar.gz"
sha256 "8bedeea8ed636891fd7351fa7ccbc75fdb5bee6efde5320162f712e8457e73ea"
if Hardware::CPU.intel?
url "https://github.com/rhysd/actionlint/releases/download/v1.6.26/actionlint_1.6.26_linux_amd64.tar.gz"
sha256 "f0294c342af98fad4ff917bc32032f28e1b55f76aedf291886ec10bbed7c12e1"

def install
bin.install "actionlint"
Expand Down
Loading

0 comments on commit 340fcb1

Please sign in to comment.