Skip to content

Fix licensing.

Fix licensing. #98

name: Run Tests and generate output files
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
pull_request:
branches:
- master
paths:
- 'source/**'
- 'scripts/convert**'
- 'resources/templates/**'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
permissions:
contents: read
jobs:
hardening:
uses: ./.github/workflows/hardening.yaml
runtests:
needs: hardening
uses: ./.github/workflows/run-tests.yaml
# If Tests pass, generate new output files
uploadoutputfiles:
name: Upload Output Files
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
needs: runtests
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- name: Create tmp branch for artifacts and get parent and object ref
id: find-target
env:
PR_NUMBER: ${{ github.event.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
run: |
echo "parent=`git rev-parse HEAD`" >> "$GITHUB_ENV"
echo "object_tree=`git write-tree`" >> "$GITHUB_ENV"
git switch --orphan "tmp-$BRANCH_NAME-artifacts"
- name: Commit empty commit to the tmp artifact branch
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
env:
TARGET_BRANCH: ${{ github.event.pull_request.head.ref }}
with:
script: |
const { TARGET_BRANCH } = process.env
const commit_msg = "Upload artifacts"
const parent = "${{ env.parent}}";
const object_tree = "${{ env.object_tree}}";
const { data: commit } = await github.rest.git.createCommit({
owner: context.repo.owner,
repo: context.repo.repo,
message: commit_msg,
tree: object_tree,
parents: [parent]
});
try {
const { data: ref } = await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/heads/tmp-${TARGET_BRANCH}-artifacts`,
sha: commit.sha
})
} catch (e) {
//The branch already exists
}
- name: Checkout branch for pull request
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
ref: ${{ github.event.pull_request.head.ref }}
# Set the pip environment up
- name: Get Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.10'
cache: 'pipenv' # caching pip dependencies
- name: Install dependencies
run: |
pip install -r requirements.txt --require-hashes
pipenv install -d
- name: Generate new output files
run: |
pipenv run python scripts/convert.py -l all -t all -s all
- name: Create pull request artifacts
uses: gavv/pull-request-artifacts@93f32f061d1fabdb41104db2493f2260c7db774f # v2.1
with:
commit: ${{ github.event.pull_request.head.sha }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
comment-message: "The generated Cornucopia cards in this pull request."
artifacts-branch: tmp-${{ github.event.pull_request.head.ref }}-artifacts
artifacts: |
output/owasp_cornucopia_webapp_cards_en_1.30_dynamic.docx
output/owasp_cornucopia_webapp_cards_en_1.30_dynamic.idml
output/owasp_cornucopia_webapp_cards_en_1.30_dynamic.pdf
output/owasp_cornucopia_webapp_cards_en_1.30_leaflet.idml
output/owasp_cornucopia_webapp_cards_en_1.30_static.docx
output/owasp_cornucopia_webapp_cards_en_1.30_static.idml
output/owasp_cornucopia_webapp_cards_en_1.30_static.pdf
output/owasp_cornucopia_webapp_cards_es_1.30_dynamic.docx
output/owasp_cornucopia_webapp_cards_es_1.30_dynamic.pdf
output/owasp_cornucopia_webapp_cards_es_1.30_dynamic.idml
output/owasp_cornucopia_webapp_cards_es_1.30_leaflet.idml
output/owasp_cornucopia_webapp_cards_es_1.30_static.docx
output/owasp_cornucopia_webapp_cards_es_1.30_static.pdf
output/owasp_cornucopia_webapp_cards_es_1.30_static.idml
output/owasp_cornucopia_webapp_cards_fr_1.30_dynamic.docx
output/owasp_cornucopia_webapp_cards_fr_1.30_dynamic.idml
output/owasp_cornucopia_webapp_cards_fr_1.30_dynamic.pdf
output/owasp_cornucopia_webapp_cards_fr_1.30_leaflet.idml
output/owasp_cornucopia_webapp_cards_fr_1.30_static.docx
output/owasp_cornucopia_webapp_cards_fr_1.30_static.idml
output/owasp_cornucopia_webapp_cards_fr_1.30_static.pdf
output/owasp_cornucopia_webapp_cards_nl_1.30_dynamic.docx
output/owasp_cornucopia_webapp_cards_nl_1.30_dynamic.idml
output/owasp_cornucopia_webapp_cards_nl_1.30_dynamic.pdf
output/owasp_cornucopia_webapp_cards_nl_1.30_leaflet.idml
output/owasp_cornucopia_webapp_cards_nl_1.30_static.docx
output/owasp_cornucopia_webapp_cards_nl_1.30_static.idml
output/owasp_cornucopia_webapp_cards_nl_1.30_static.pdf
output/owasp_cornucopia_webapp_cards_no-nb_1.30_dynamic.docx
output/owasp_cornucopia_webapp_cards_no-nb_1.30_dynamic.idml
output/owasp_cornucopia_webapp_cards_no-nb_1.30_dynamic.pdf
output/owasp_cornucopia_webapp_cards_no-nb_1.30_leaflet.idml
output/owasp_cornucopia_webapp_cards_no-nb_1.30_static.docx
output/owasp_cornucopia_webapp_cards_no-nb_1.30_static.idml
output/owasp_cornucopia_webapp_cards_no-nb_1.30_static.pdf
output/owasp_cornucopia_webapp_cards_pt-br_1.30_dynamic.docx
output/owasp_cornucopia_webapp_cards_pt-br_1.30_dynamic.idml
output/owasp_cornucopia_webapp_cards_pt-br_1.30_dynamic.pdf
output/owasp_cornucopia_webapp_cards_pt-br_1.30_leaflet.idml
output/owasp_cornucopia_webapp_cards_pt-br_1.30_static.docx
output/owasp_cornucopia_webapp_cards_pt-br_1.30_static.idml
output/owasp_cornucopia_webapp_cards_pt-br_1.30_static.pdf
output/owasp_cornucopia_mobileapp_cards_en_1.00_static.idml
output/owasp_cornucopia_mobileapp_cards_en_1.00_leaflet.idml