Skip to content

Commit

Permalink
Add image for 'actionlint'
Browse files Browse the repository at this point in the history
actionlint does static analysis of GitHub Action workflow files.
By having our own image we can be sure the binary doesn't get
changed out from under us.
  • Loading branch information
SeanTAllen committed Aug 10, 2023
1 parent 5feb1f7 commit 9176808
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 9 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/linux-builder-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Docker login
run: "docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD"
run: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
Expand All @@ -40,7 +40,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Docker login
run: "docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD"
run: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
Expand All @@ -67,7 +67,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Docker login
run: "docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD"
run: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
Expand All @@ -94,7 +94,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Docker login
run: "docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD"
run: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
Expand All @@ -121,7 +121,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Docker login
run: "docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD"
run: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
Expand All @@ -148,7 +148,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Docker login
run: "docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD"
run: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
Expand All @@ -175,7 +175,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Docker login
run: "docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD"
run: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
Expand All @@ -202,7 +202,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Docker login
run: "docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD"
run: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,21 @@ name: PR

on: pull_request

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

jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Check workflow files
uses: docker://ponylang/shared-docker-ci-actionlint:20230810
with:
args: -color

superlinter:
name: Lint bash, docker, markdown, and yaml
runs-on: ubuntu-latest
Expand All @@ -18,6 +32,14 @@ jobs:
VALIDATE_MD: true
VALIDATE_YAML: true

validate-actionlint-image-builds:
name: Validate release Docker image builds
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Docker build
run: "docker build --pull --file=actionlint/Dockerfile ."

validate-release-a-library-image-builds:
name: Validate release-a-library Docker image builds
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-a-library-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Docker login
run: "docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD"
run: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
Expand Down
15 changes: 15 additions & 0 deletions actionlint/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM alpine:3.18

RUN apk add --update --no-cache \
bash \
py3-pyflakes \
shellcheck

RUN cd /tmp && \
wget https://github.com/rhysd/actionlint/releases/download/v1.6.25/actionlint_1.6.25_linux_386.tar.gz && \
tar xf actionlint_1.6.25_linux_386.tar.gz && \
cp actionlint /usr/bin/ && \
chmod a+x /usr/bin/actionlint && \
rm -rf /tmp/*

ENTRYPOINT ["/usr/bin/actionlint"]
15 changes: 15 additions & 0 deletions actionlint/build-and-push.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -o errexit
set -o nounset

#
# *** You should already be logged in to DockerHub when you run this ***
#

NAME="ponylang/shared-docker-ci-actionlint"
TODAY=$(date +%Y%m%d)
DOCKERFILE_DIR="$(dirname "$0")"

docker build --pull -t "${NAME}:${TODAY}" "${DOCKERFILE_DIR}"
docker push "${NAME}:${TODAY}"

0 comments on commit 9176808

Please sign in to comment.