Skip to content

Commit

Permalink
🌱 Switch from paths-ignore to changed-files action to skip required c…
Browse files Browse the repository at this point in the history
…hecks. (ossf#2566)

* Switch from paths-ignore to changed-files action. This allows doc only changes to pass CI, which are currently blocked waiting for these required checks which will never run due to the path filter.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Pin checkout action. Disable redundant docker build on push to main since cloud build handles the images.

Signed-off-by: Spencer Schrock <sschrock@google.com>

Signed-off-by: Spencer Schrock <sschrock@google.com>
  • Loading branch information
spencerschrock authored and raghavkaul committed Feb 9, 2023
1 parent 4a723d5 commit 553eaa3
Showing 1 changed file with 44 additions and 8 deletions.
52 changes: 44 additions & 8 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,45 @@ permissions:
name: docker-build

on:
push:
branches:
- main
paths-ignore:
- "*.md"
pull_request:
branches:
- main
paths-ignore:
- "*.md"

env:
PROTOC_VERSION: 3.17.3
GO_VERSION: 1.17
GO_VERSION: 1.19

jobs:
docs_only_check:
name: Check for docs-only change
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
docs_only: ${{ steps.docs_only_check.outputs.docs_only }}
steps:
- name: Check out code
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b #v3.2.0
with:
fetch-depth: 2
- id: files
name: Get changed files
uses: tj-actions/changed-files@0626c3f94002c0a9d7491dd7fed7055bbdff6f92 #v35.1.0
with:
files_ignore: '**.md'
- id: docs_only_check
if: steps.files.outputs.any_changed != 'true'
name: Check for docs-only changes
run: echo "docs_only=true" >> $GITHUB_OUTPUT

scorecard:
name: scorecard-docker
runs-on: ubuntu-latest
permissions:
contents: read
needs:
- docs_only_check
if: (needs.docs_only_check.outputs.docs_only != 'true')
steps:
- name: Harden Runner
uses: step-security/harden-runner@ebacdc22ef6c2cfb85ee5ded8f2e640f4c776dd5 # v1
Expand Down Expand Up @@ -84,6 +102,9 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
needs:
- docs_only_check
if: (needs.docs_only_check.outputs.docs_only != 'true')
steps:
- name: Harden Runner
uses: step-security/harden-runner@ebacdc22ef6c2cfb85ee5ded8f2e640f4c776dd5 # v1
Expand Down Expand Up @@ -129,6 +150,9 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
needs:
- docs_only_check
if: (needs.docs_only_check.outputs.docs_only != 'true')
steps:
- name: Harden Runner
uses: step-security/harden-runner@ebacdc22ef6c2cfb85ee5ded8f2e640f4c776dd5 # v1
Expand Down Expand Up @@ -174,6 +198,9 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
needs:
- docs_only_check
if: (needs.docs_only_check.outputs.docs_only != 'true')
steps:
- name: Harden Runner
uses: step-security/harden-runner@ebacdc22ef6c2cfb85ee5ded8f2e640f4c776dd5 # v1
Expand Down Expand Up @@ -219,6 +246,9 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
needs:
- docs_only_check
if: (needs.docs_only_check.outputs.docs_only != 'true')
steps:
- name: Harden Runner
uses: step-security/harden-runner@ebacdc22ef6c2cfb85ee5ded8f2e640f4c776dd5 # v1
Expand Down Expand Up @@ -264,6 +294,9 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
needs:
- docs_only_check
if: (needs.docs_only_check.outputs.docs_only != 'true')
steps:
- name: Harden Runner
uses: step-security/harden-runner@ebacdc22ef6c2cfb85ee5ded8f2e640f4c776dd5 # v1
Expand Down Expand Up @@ -309,6 +342,9 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
needs:
- docs_only_check
if: (needs.docs_only_check.outputs.docs_only != 'true')
steps:
- name: Harden Runner
uses: step-security/harden-runner@ebacdc22ef6c2cfb85ee5ded8f2e640f4c776dd5 # v1
Expand Down

0 comments on commit 553eaa3

Please sign in to comment.