|
| 1 | +name: Wardnet MISP severity parent restack (temporary) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - fix/misp-threat-level-severity |
| 7 | + paths: |
| 8 | + - .github/workflows/wardnet-child-restack.yml |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: write |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: wardnet-child-restack-${{ github.ref }} |
| 15 | + cancel-in-progress: false |
| 16 | + |
| 17 | +jobs: |
| 18 | + restack: |
| 19 | + runs-on: macos-15 |
| 20 | + steps: |
| 21 | + - name: Checkout triggering child head |
| 22 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 |
| 23 | + with: |
| 24 | + ref: ${{ github.sha }} |
| 25 | + fetch-depth: 0 |
| 26 | + - name: Adopt exact stable parent without rewriting history |
| 27 | + shell: bash |
| 28 | + env: |
| 29 | + EXPECTED_PARENT: 0c83cd5956f512d79c6600e823fcfa6d6f32af4e |
| 30 | + PARENT_BRANCH: fix/misp-to-ids-fail-closed |
| 31 | + run: | |
| 32 | + set -euo pipefail |
| 33 | + git fetch origin "${PARENT_BRANCH}:refs/remotes/origin/${PARENT_BRANCH}" "${GITHUB_REF_NAME}:refs/remotes/origin/${GITHUB_REF_NAME}" |
| 34 | + test "$(git rev-parse "origin/${PARENT_BRANCH}")" = "${EXPECTED_PARENT}" |
| 35 | + test "$(git rev-parse "origin/${GITHUB_REF_NAME}")" = "${GITHUB_SHA}" |
| 36 | + git merge --no-ff --no-commit "${EXPECTED_PARENT}" |
| 37 | + git rm .github/workflows/wardnet-child-restack.yml |
| 38 | + cargo fmt --all -- --check |
| 39 | + git diff --check --cached |
| 40 | + - name: Install Rust toolchain |
| 41 | + uses: dtolnay/rust-toolchain@4be7066ada62dd38de10e7b70166bc74ed198c30 # stable |
| 42 | + with: |
| 43 | + toolchain: stable |
| 44 | + - name: Verify complete inherited parent and severity child |
| 45 | + shell: bash |
| 46 | + run: | |
| 47 | + set -euo pipefail |
| 48 | + cargo test --locked --workspace |
| 49 | + cargo clippy --locked --workspace --all-targets -- -D warnings |
| 50 | + - name: Commit, prove three-file child delta, and non-force push |
| 51 | + shell: bash |
| 52 | + env: |
| 53 | + EXPECTED_PARENT: 0c83cd5956f512d79c6600e823fcfa6d6f32af4e |
| 54 | + PARENT_BRANCH: fix/misp-to-ids-fail-closed |
| 55 | + run: | |
| 56 | + set -euo pipefail |
| 57 | + git fetch origin "${PARENT_BRANCH}:refs/remotes/origin/${PARENT_BRANCH}" "${GITHUB_REF_NAME}:refs/remotes/origin/${GITHUB_REF_NAME}" |
| 58 | + test "$(git rev-parse "origin/${PARENT_BRANCH}")" = "${EXPECTED_PARENT}" |
| 59 | + test "$(git rev-parse "origin/${GITHUB_REF_NAME}")" = "${GITHUB_SHA}" |
| 60 | + git config user.name "github-actions[bot]" |
| 61 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 62 | + git commit -m "chore: adopt MISP admission parent 0c83cd5" |
| 63 | + actual="$(git diff --name-only "${EXPECTED_PARENT}"...HEAD | sort)" |
| 64 | + expected=$'docs/doctoring/misp-threat-level-severity.md\nsrc/misp_import.rs\ntests/misp_threat_level_severity.rs' |
| 65 | + test "${actual}" = "${expected}" |
| 66 | + git push origin "HEAD:refs/heads/${GITHUB_REF_NAME}" |
0 commit comments