Skip to content

Dummy change to test CI/CD #215

Dummy change to test CI/CD

Dummy change to test CI/CD #215

Workflow file for this run

name: Update models
# Controls when the workflow will run
on:
# Triggers the workflow on push events for main and dev branches
push:
branches: [ "main", "dev" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/[email protected]
with:
python-version: 3.11.3
- name: Checkout threatmodel repo
uses: actions/checkout@v3
with:
token: ${{ secrets.DEV_GITHUB_TOKEN }}
- name: Get changed threat models
id: changed-files-specific
uses: tj-actions/changed-files@v36
with:
files: ./*.json
- name: Validate models
id: validate
run: |
pip install -r requirements.txt
python3 src/publish/validate-models.py ${{ steps.changed-files-specific.outputs.all_changed_files }}
continue-on-error: true
- name: Revert last commit if validation fails
if: steps.validate.outcome == 'failure'
run: |
git revert -m 1 HEAD --no-edit --no-commit
- name: slack-send
if: steps.validate.outcome == 'failure'
uses: slackapi/[email protected]
with:
# Slack channel ID where message will be posted. Needed if using bot token
channel-id: 'C05BY6YNDFF'
# Message to post into Slack. Needed if using bot token
slack-message: "GitHub threat models validation on branch ${{ github.ref }} failed, commit has been reverted"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- name: Update models hash and date
if: steps.validate.outcome == 'success'
run: python3 src/publish/update-models.py ${{ steps.changed-files-specific.outputs.all_changed_files }}
- name: Commit & Push changes
uses: actions-js/push@master
with:
github_token: ${{ secrets.DEV_GITHUB_TOKEN }}
branch: ${{ github.ref_name }}