Skip to content
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
8 changes: 6 additions & 2 deletions .github/workflows/build-and-publish-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@ jobs:
- uses: actions/checkout@v7

- name: 'Login to GitHub Container Registry'
if: github.event_name != 'pull_request'
uses: docker/login-action@v4.7.0
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}

- name: 'Build and publish Docker image'
- name: 'Build Docker image'
run: |
docker build ./docker/ --tag ghcr.io/owasp/asvs/documentbuilder:latest
docker push ghcr.io/owasp/asvs/documentbuilder:latest

- name: 'Publish Docker image'
if: github.event_name != 'pull_request'
run: docker push ghcr.io/owasp/asvs/documentbuilder:latest

18 changes: 17 additions & 1 deletion .github/workflows/build-documents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,29 @@ jobs:
filters: |
docker:
- 'docker/**/*'
- '.github/workflows/build-documents.yml'
- '.github/workflows/build-and-publish-docker-image.yml'
v5:
- '5.0/**/*'
- 'docker/**/*'
- 'Makefile'
- '.github/workflows/build-documents.yml'
- '.github/workflows/build-and-publish-docker-image.yml'
- '.github/workflows/create-5.0-outputs.yml'
v4:
- '4.0/**/*'
- 'docker/**/*'
- 'Makefile'
- '.github/workflows/build-documents.yml'
- '.github/workflows/build-and-publish-docker-image.yml'
- '.github/workflows/create-4.0-outputs.yml'
outputs:
docker: ${{ steps.filter.outputs.docker }}
v4: ${{ steps.filter.outputs.v4 }}
v5: ${{ steps.filter.outputs.v5 }}

build-image:
if: needs.filters.outputs.docker == 'true'
if: github.event_name != 'pull_request' && needs.filters.outputs.docker == 'true'
needs: filters
uses: ./.github/workflows/build-and-publish-docker-image.yml

Expand All @@ -42,13 +54,17 @@ jobs:
- build-image
- filters
uses: ./.github/workflows/create-4.0-outputs.yml
with:
build_local_image: ${{ github.event_name == 'pull_request' && needs.filters.outputs.docker == 'true' }}

build-v5:
if: ${{ always() && needs.filters.outputs.v5 == 'true' }}
needs:
- build-image
- filters
uses: ./.github/workflows/create-5.0-outputs.yml
with:
build_local_image: ${{ github.event_name == 'pull_request' && needs.filters.outputs.docker == 'true' }}

publish-v5-latest:
if: ${{ always() && github.event_name == 'push' && needs.filters.outputs.v5 == 'true' && github.ref == 'refs/heads/master' && (needs.build-v5.result == 'success') }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/config/local-custom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,4 @@ khalidwalamri
Piotr
Kleszcz
Makna
RSASSA
20 changes: 19 additions & 1 deletion .github/workflows/create-4.0-outputs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ name: Generate 4.0 Outputs
on:
# Scan on workflow call
workflow_call:
inputs:
build_local_image:
description: Build and use the document builder from this checkout
required: false
default: false
type: boolean
# Scan on-demand through GitHub Actions interface:
workflow_dispatch: {}

Expand All @@ -13,12 +19,24 @@ jobs:
name: Generate 4.0 outputs
steps:
- uses: docker/login-action@v4.7.0
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- uses: actions/checkout@v7
- run: make 4.0
- name: Build local document builder
if: inputs.build_local_image
run: docker build ./docker/ --tag ghcr.io/owasp/asvs/documentbuilder:latest
- name: Generate documents
run: |
if [ "$BUILD_LOCAL_IMAGE" = "true" ]; then
make -o docker 4.0
else
make 4.0
fi
env:
BUILD_LOCAL_IMAGE: ${{ inputs.build_local_image }}
- uses: actions/upload-artifact@v7.0.2
with:
name: ASVS 4.0.3
Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/create-5.0-outputs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
# Scan on workflow call
workflow_call:
inputs:
build_local_image:
description: Build and use the document builder from this checkout
required: false
default: false
type: boolean
languages:
description: 'Languages to build (space-separated, e.g., "en tr")'
required: false
Expand All @@ -30,13 +35,24 @@ jobs:
name: Generate 5.0 outputs
steps:
- uses: docker/login-action@v4.7.0
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- uses: actions/checkout@v7
- run: make 5.0
- name: Build local document builder
if: inputs.build_local_image
run: docker build ./docker/ --tag ghcr.io/owasp/asvs/documentbuilder:latest
- name: Generate documents
run: |
if [ "$BUILD_LOCAL_IMAGE" = "true" ]; then
make -o docker 5.0
else
make 5.0
fi
env:
BUILD_LOCAL_IMAGE: ${{ inputs.build_local_image }}
LANGS: ${{ inputs.languages || github.event.inputs.languages || 'en' }}
- uses: actions/upload-artifact@v7.0.2
with:
Expand Down
22 changes: 19 additions & 3 deletions .github/workflows/spell-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ on:
paths:
- '**/*.md'
- '**/*.markdown'
- '.github/workflows/spell-check.yml'
- '.github/workflows/config/cspell.json'
- '.github/workflows/config/local-custom.txt'
pull_request:
branches:
- master
paths:
- '**/*.md'
- '**/*.markdown'
- '.github/workflows/spell-check.yml'
- '.github/workflows/config/cspell.json'
- '.github/workflows/config/local-custom.txt'
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -42,8 +48,18 @@ jobs:
*.md
separator: '\n'

- name: Detect spell-check workflow or configuration changes
if: github.event_name == 'pull_request'
id: config
uses: tj-actions/changed-files@v47
with:
files: |
.github/workflows/spell-check.yml
.github/workflows/config/cspell.json
.github/workflows/config/local-custom.txt

- name: Run cspell on changed files (PR)
if: github.event_name == 'pull_request' && steps.files.outputs.any_changed == 'true'
if: github.event_name == 'pull_request' && steps.config.outputs.any_changed != 'true' && steps.files.outputs.any_changed == 'true'
run: |
# Convert literal '\n' to real newlines for safe file splitting
files_string="${{ steps.files.outputs.all_changed_files }}"
Expand All @@ -60,7 +76,7 @@ jobs:
# Run cspell on all changed files; its exit code will control the workflow outcome
cspell --no-must-find-files --config .github/workflows/config/cspell.json "${files[@]}"

- name: Run cspell on all markdown files (push to main or manual)
if: github.event_name != 'pull_request'
- name: Run cspell on all markdown files (workflow/config changes, push or manual)
if: github.event_name != 'pull_request' || steps.config.outputs.any_changed == 'true'
run: |
cspell --config .github/workflows/config/cspell.json "5.0/en/**/*.md" "*.md"
17 changes: 16 additions & 1 deletion .github/workflows/url-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ on:
pull_request:
paths:
- '5.0/**'
- '.github/workflows/url-checker.yml'
- '.github/workflows/config/url-checker-config.json'
push:
branches:
- master
paths:
- '5.0/**'
- '.github/workflows/url-checker.yml'
- '.github/workflows/config/url-checker-config.json'
workflow_dispatch:

jobs:
Expand All @@ -23,10 +27,21 @@ jobs:
- name: Install markdown-link-check
run: npm i -g markdown-link-check@3.14.2

- name: Detect URL-checker workflow or configuration changes
if: github.event_name == 'pull_request'
id: config
uses: tj-actions/changed-files@v47
with:
files: |
.github/workflows/url-checker.yml
.github/workflows/config/url-checker-config.json

- name: Determine files to check
id: files
env:
CHECK_ALL: ${{ steps.config.outputs.any_changed }}
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
if [[ "${{ github.event_name }}" == "pull_request" && "$CHECK_ALL" != "true" ]]; then
git diff --name-only --diff-filter=AM origin/${{ github.base_ref }} -- 5.0/ | grep '\.md$' > /tmp/files_to_check.txt || true
echo "mode=modified" >> $GITHUB_OUTPUT
else
Expand Down
Loading