Re: [PR] Lint GitHub Actions workflows with actionlint [maven]
ascheman closed pull request #13083: Lint GitHub Actions workflows with actionlint URL: https://github.com/apache/maven/pull/13083 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] Lint GitHub Actions workflows with actionlint [maven]
ascheman commented on PR #13083: URL: https://github.com/apache/maven/pull/13083#issuecomment-5748408584 Superseded by #13206, which adds the same actionlint check via the shared reusable workflow in `apache/maven-gh-actions-shared` (a one-line caller of `actionlint.yml@v5`) instead of duplicating the super-linter setup here. That keeps the actionlint configuration in one place for all Maven repositories. Closing in favor of #13206 (draft until the shared workflow lands on `v5`: apache/maven-gh-actions-shared#322). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] Lint GitHub Actions workflows with actionlint [maven]
Copilot commented on code in PR #13083:
URL: https://github.com/apache/maven/pull/13083#discussion_r3975955360
##
.github/workflows/actionlint.yml:
##
@@ -0,0 +1,64 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Lints the GitHub Actions workflows themselves with actionlint
+# (https://github.com/rhysd/actionlint): workflow syntax, expression contexts,
+# and embedded shell (via shellcheck). actionlint is run through
+# github/super-linter (restricted to the GitHub Actions validator) because the
+# ASF org allowed-actions policy permits GitHub-owned actions but not the
+# stand-alone actionlint action/image. Only runs when a workflow file changes.
+name: Actionlint
+
+on:
+ push:
+paths:
+ - '.github/workflows/**'
+ pull_request:
+paths:
+ - '.github/workflows/**'
+
+# cancel superseded runs on the same ref (e.g. rapid pushes to a branch)
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+permissions:
+ contents: read
+
+jobs:
+ actionlint:
+name: Lint GitHub Actions workflows
+runs-on: ubuntu-latest
+steps:
+ - name: Checkout maven
+uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #
v7.0.1
+with:
+ persist-credentials: false
+ # super-linter needs full history to resolve the commit range
+ fetch-depth: 0
+
+ # super-linter is GitHub-owned, so it satisfies the ASF allowed-actions
+ # policy (a stand-alone actionlint action/image is not on the allowlist).
+ # VALIDATE_GITHUB_ACTIONS restricts it to actionlint only; other linters
+ # (shellcheck, yaml, ...) can be enabled later via more VALIDATE_* flags.
+ - name: Lint workflows with actionlint (via super-linter)
+uses:
github/super-linter/slim@b807e99ddd37e444d189cfd2c2ca1274d8ae8ef1 # v7
+env:
+ VALIDATE_ALL_CODEBASE: true
+ VALIDATE_GITHUB_ACTIONS: true
+ DEFAULT_BRANCH: master
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Review Comment:
`DEFAULT_BRANCH` is hard-coded to `master`, which can make the job behave
incorrectly on forks where the default branch name differs (and upstream
super-linter docs note you typically should not set `DEFAULT_BRANCH` on GitHub
Actions unless you intentionally want to override the repository default).
Removing this line lets super-linter use the repository’s actual default branch
from the event payload, aligning with the PR’s goal of giving early feedback on
contributor forks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] Lint GitHub Actions workflows with actionlint [maven]
ascheman commented on PR #13083: URL: https://github.com/apache/maven/pull/13083#issuecomment-5613790846 **Update after review — reworked, and now green on CI.** The original `docker://rhysd/actionlint` approach was blocked by the ASF allowed-actions policy (the run was a `startup_failure` — external Docker images aren't on the org allowlist), so digest-pinning wouldn't have helped. Reworked to: - **`github/super-linter/slim`** — GitHub-owned, so it's on the ASF allowlist — restricted to `VALIDATE_GITHUB_ACTIONS`, i.e. it runs **actionlint**. SHA-pinned (`b807e99…`, v7). - Added `fetch-depth: 0` (super-linter needs full history). CI is green now ✅. This also resolves the earlier feedback: @gnodet's pinning note (now SHA-pinned) and the Copilot `permissions` note (now `contents: read`). Bonus: super-linter bundles shellcheck/yaml/etc., so coverage can be extended later via more `VALIDATE_*` flags without allowlisting new actions; and the SHA+comment pin is auto-renovated by the repo's existing `github-actions` Dependabot. **Supporting data:** I ran actionlint across 121 locally-checked-out Maven repos — 17 have ≥1 finding (86 total). ~79% are `SC2086` quoting nits, but there's also a real broken shell test in `maven-gh-actions-shared` and a few stale action pins. So a **shared reusable workflow in `apache/maven-gh-actions-shared`** would catch these ecosystem-wide, adopted per-repo over time — which is the open question here: standalone per-repo vs centralize? WDYT @slawekjaranowski? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] Lint GitHub Actions workflows with actionlint [maven]
Copilot commented on code in PR #13083:
URL: https://github.com/apache/maven/pull/13083#discussion_r3970816251
##
.github/workflows/actionlint.yml:
##
@@ -0,0 +1,62 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Lints the GitHub Actions workflows themselves with actionlint
+# (https://github.com/rhysd/actionlint): workflow syntax, expression contexts,
+# and embedded shell (via shellcheck). actionlint is run through
+# github/super-linter (restricted to the GitHub Actions validator) because the
+# ASF org allowed-actions policy permits GitHub-owned actions but not the
+# stand-alone actionlint action/image. Only runs when a workflow file changes.
+name: Actionlint
+
+on:
+ push:
+paths:
+ - '.github/workflows/**'
+ pull_request:
+paths:
+ - '.github/workflows/**'
+
+# cancel superseded runs on the same ref (e.g. rapid pushes to a branch)
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+permissions:
+ contents: read
+
+jobs:
+ actionlint:
+name: Lint GitHub Actions workflows
+runs-on: ubuntu-latest
+steps:
+ - name: Checkout maven
+uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #
v7.0.1
+with:
+ persist-credentials: false
+
+ # super-linter is GitHub-owned, so it satisfies the ASF allowed-actions
+ # policy (a stand-alone actionlint action/image is not on the allowlist).
+ # VALIDATE_GITHUB_ACTIONS restricts it to actionlint only; other linters
+ # (shellcheck, yaml, ...) can be enabled later via more VALIDATE_* flags.
+ - name: Lint workflows with actionlint (via super-linter)
+uses:
github/super-linter/slim@b807e99ddd37e444d189cfd2c2ca1274d8ae8ef1 # v7
+env:
+ VALIDATE_ALL_CODEBASE: true
+ VALIDATE_GITHUB_ACTIONS: true
+ DEFAULT_BRANCH: master
Review Comment:
The workflow sets `DEFAULT_BRANCH: master`, but the PR metadata indicates
the base branch is `main` (and this repo may not use `master`). Either set this
to the repository’s actual default branch, or avoid hardcoding by using the
repository default branch value (so this doesn’t become stale if branch naming
changes).
##
.github/workflows/actionlint.yml:
##
@@ -0,0 +1,62 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Lints the GitHub Actions workflows themselves with actionlint
+# (https://github.com/rhysd/actionlint): workflow syntax, expression contexts,
+# and embedded shell (via shellcheck). actionlint is run through
+# github/super-linter (restricted to the GitHub Actions validator) because the
+# ASF org allowed-actions policy permits GitHub-owned actions but not the
+# stand-alone actionlint action/image. Only runs when a workflow file changes.
+name: Actionlint
+
+on:
+ push:
+paths:
+ - '.github/workflows/**'
+ pull_request:
+paths:
+ - '.github/workflows/**'
+
+# cancel superseded runs on the same ref (e.g. rapid pushes to a branch)
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+permissions:
+ contents: read
+
+jobs:
+ actionlint:
+name: Lint GitHub Actions workflows
+runs-on: ubuntu-latest
+steps:
+ - name: Checkout maven
+uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #
v7.0.1
+with:
+ persist-credentials: false
+
+ # super-linter is GitHub-owned, so it satisfies
Re: [PR] Lint GitHub Actions workflows with actionlint [maven]
Copilot commented on code in PR #13083:
URL: https://github.com/apache/maven/pull/13083#discussion_r3970490400
##
.github/workflows/actionlint.yml:
##
@@ -0,0 +1,56 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Lints the GitHub Actions workflows themselves with actionlint
+# (https://github.com/rhysd/actionlint): workflow syntax, expression
+# contexts, and embedded shell (via shellcheck). Only runs when a workflow
+# file changes.
+name: Actionlint
+
+on:
+ push:
+paths:
+ - '.github/workflows/**'
+ pull_request:
+paths:
+ - '.github/workflows/**'
+
+# cancel superseded runs on the same ref (e.g. rapid pushes to a branch)
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+# clear all permissions for GITHUB_TOKEN
+permissions: {}
+
+jobs:
+ actionlint:
+runs-on: ubuntu-latest
+steps:
+ - name: Checkout maven
+uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #
v7.0.1
+with:
+ persist-credentials: false
Review Comment:
`permissions: {}` removes `contents: read`, which `actions/checkout`
typically requires to fetch the repository. This can cause the job to fail at
checkout; set minimal required permissions (e.g., `permissions: { contents:
read }`) at the workflow or job level.
##
.github/workflows/actionlint.yml:
##
@@ -0,0 +1,56 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Lints the GitHub Actions workflows themselves with actionlint
+# (https://github.com/rhysd/actionlint): workflow syntax, expression
+# contexts, and embedded shell (via shellcheck). Only runs when a workflow
+# file changes.
+name: Actionlint
+
+on:
+ push:
+paths:
+ - '.github/workflows/**'
+ pull_request:
+paths:
+ - '.github/workflows/**'
+
+# cancel superseded runs on the same ref (e.g. rapid pushes to a branch)
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+# clear all permissions for GITHUB_TOKEN
+permissions: {}
+
+jobs:
+ actionlint:
+runs-on: ubuntu-latest
+steps:
+ - name: Checkout maven
+uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #
v7.0.1
+with:
+ persist-credentials: false
+
+ # Runs actionlint over .github/workflows/** (auto-discovered).
+ # NOTE (for review): pinned to a version tag here for readability; if we
+ # adopt this, pin to the image digest to match how the other workflows
+ # pin their actions by SHA.
+ - name: Run actionlint
+uses: docker://rhysd/actionlint:1.7.12
+with:
+ args: -color
Review Comment:
Using a mutable Docker tag enables supply-chain risk (the tag can be
repointed). Pin the `docker://` reference to an immutable image digest (or use
an action pinned by commit SHA) so the workflow is reproducible and aligns with
the repo’s existing pinning approach.
##
.github/workflows/actionlint.yml:
##
@@ -0,0 +1,56 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+#
Re: [PR] Lint GitHub Actions workflows with actionlint [maven]
gnodet commented on code in PR #13083:
URL: https://github.com/apache/maven/pull/13083#discussion_r3970374328
##
.github/workflows/actionlint.yml:
##
@@ -0,0 +1,56 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Lints the GitHub Actions workflows themselves with actionlint
+# (https://github.com/rhysd/actionlint): workflow syntax, expression
+# contexts, and embedded shell (via shellcheck). Only runs when a workflow
+# file changes.
+name: Actionlint
+
+on:
+ push:
+paths:
+ - '.github/workflows/**'
+ pull_request:
+paths:
+ - '.github/workflows/**'
+
+# cancel superseded runs on the same ref (e.g. rapid pushes to a branch)
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+# clear all permissions for GITHUB_TOKEN
+permissions: {}
+
+jobs:
+ actionlint:
+runs-on: ubuntu-latest
+steps:
+ - name: Checkout maven
+uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #
v7.0.1
+with:
+ persist-credentials: false
+
+ # Runs actionlint over .github/workflows/** (auto-discovered).
+ # NOTE (for review): pinned to a version tag here for readability; if we
+ # adopt this, pin to the image digest to match how the other workflows
+ # pin their actions by SHA.
+ - name: Run actionlint
+uses: docker://rhysd/actionlint:1.7.12
+with:
Review Comment:
Per project convention, this should be pinned by image digest rather than
version tag:
```suggestion
uses: docker://rhysd/actionlint@sha256:
```
You can find the digest with:
```
docker pull rhysd/actionlint:1.7.12
docker inspect --format='{{index .RepoDigests 0}}' rhysd/actionlint:1.7.12
```
The code comment at line 52-54 already flags this — just leaving a concrete
suggestion for the final version.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
