diff --git a/.github/workflows/reusable-create-translation-branch.yml b/.github/workflows/reusable-create-translation-branch.yml new file mode 100644 index 000000000000..62e446471bf3 --- /dev/null +++ b/.github/workflows/reusable-create-translation-branch.yml @@ -0,0 +1,37 @@ +name: Create new translation version branch in language repository + +on: + workflow_call: + inputs: + source_branch: + required: true + type: string + source_folder: + required: true + type: string + new_branch_name: + required: true + type: string + +jobs: + pull_and_create_branch: + runs-on: ubuntu-latest + + steps: + - name: Checkout current repo + uses: actions/checkout@v3 + - name: Set up Git with GitHub Actions bot identity + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + - name: Pull content from another repository + run: | + git clone --branch ${{ inputs.source_branch }} --single-branch https://github.com/owaspsamm/core temp-repo + rm -rf temp-repo/.git + rsync -a --exclude='.git' temp-repo/ . + - name: Create a new branch with the pulled content + run: | + git checkout -b ${{ inputs.new_branch_name }} + git add ${{ inputs.source_folder }} + git commit -m "Pulled content from ${{ inputs.source_repo }}:${{ inputs.source_branch }}" + git push origin ${{ inputs.new_branch_name }} diff --git a/.github/workflows/reusable-yaml-process.yml b/.github/workflows/reusable-yaml-process.yml new file mode 100644 index 000000000000..01909ded3e3d --- /dev/null +++ b/.github/workflows/reusable-yaml-process.yml @@ -0,0 +1,44 @@ +name: Reusable workflow to convert yaml files to markdown + +on: + workflow_call: + inputs: + language: + required: true + type: string + branch: + required: true + type: string + model_folder: + required: true + type: string +jobs: + generate-markdown: + runs-on: ubuntu-latest + steps: + - name: 'Checkout using release is workflow dispatched' + uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + - name: 'Create output dir and copy files to override spaces in directories' + run: | + mkdir output + - name: 'Generate model for website' + uses: docker://backnot/owasp-samm-process-yaml-content:latest + with: + args: '-d ${{ inputs.model_folder }} -o output -l ${{ inputs.language }}' + - name: 'Move generated files to common directory structure' + run: | + mkdir -p build/business-function/practice/stream + BASE=output/markdown + cp "$BASE"/{Design.md,Governance.md,Implementation.md,Operations.md,Verification.md} build/business-function + cp "$BASE"/*-??-?.md build/business-function/practice/stream + cp "$BASE"/*-??.md build/business-function/practice + - name: Deploy + uses: s0/git-publish-subdir-action@develop + env: + REPO: self + BRANCH: markdown + FOLDER: build + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SQUASH_HISTORY: false