Skip to content

Commit 438ef84

Browse files
author
Alex Ashkov
committed
Added workflows that will be used from language repositories. One is for creating markdown and the other one is to pull new English core model files to language repository
1 parent 6d2c821 commit 438ef84

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Create new translation version branch in language repository
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
source_branch:
7+
required: true
8+
type: string
9+
source_folder:
10+
required: true
11+
type: string
12+
new_branch_name:
13+
required: true
14+
type: string
15+
16+
jobs:
17+
pull_and_create_branch:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout current repo
22+
uses: actions/checkout@v3
23+
- name: Set up Git with GitHub Actions bot identity
24+
run: |
25+
git config --global user.name "github-actions[bot]"
26+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
27+
- name: Pull content from another repository
28+
run: |
29+
git clone --branch ${{ inputs.source_branch }} --single-branch https://github.com/owaspsamm/core temp-repo
30+
rm -rf temp-repo/.git
31+
rsync -a --exclude='.git' temp-repo/ .
32+
- name: Create a new branch with the pulled content
33+
run: |
34+
git checkout -b ${{ inputs.new_branch_name }}
35+
git add ${{ inputs.source_folder }}
36+
git commit -m "Pulled content from ${{ inputs.source_repo }}:${{ inputs.source_branch }}"
37+
git push origin ${{ inputs.new_branch_name }}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Reusable workflow to convert yaml files to markdown
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
language:
7+
required: true
8+
type: string
9+
branch:
10+
required: true
11+
type: string
12+
model_folder:
13+
required: true
14+
type: string
15+
jobs:
16+
generate-markdown:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: 'Checkout using release is workflow dispatched'
20+
uses: actions/checkout@v3
21+
with:
22+
ref: ${{ inputs.branch }}
23+
- name: 'Create output dir and copy files to override spaces in directories'
24+
run: |
25+
mkdir output
26+
- name: 'Generate model for website'
27+
uses: docker://backnot/owasp-samm-process-yaml-content:latest
28+
with:
29+
args: '-d ${{ inputs.model_folder }} -o output -l ${{ inputs.language }}'
30+
- name: 'Move generated files to common directory structure'
31+
run: |
32+
mkdir -p build/business-function/practice/stream
33+
BASE=output/markdown
34+
cp "$BASE"/{Design.md,Governance.md,Implementation.md,Operations.md,Verification.md} build/business-function
35+
cp "$BASE"/*-??-?.md build/business-function/practice/stream
36+
cp "$BASE"/*-??.md build/business-function/practice
37+
- name: Deploy
38+
uses: s0/git-publish-subdir-action@develop
39+
env:
40+
REPO: self
41+
BRANCH: markdown
42+
FOLDER: build
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
SQUASH_HISTORY: false

0 commit comments

Comments
 (0)