Skip to content

Semaphore V4 Ceremony #65

Semaphore V4 Ceremony

Semaphore V4 Ceremony #65

# We need the directory of the ceremony to match the prefix of the ceremony.
name: Validate Directory name and prefix
on:
pull_request:
paths:
- 'ceremonies/**'
jobs:
verify:
runs-on: ubuntu-latest
if: endsWith(github.head_ref, '-ceremony')
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install jq
run: sudo apt-get install jq -y
- name: Read JSON and get title
run: |
title=$(jq -r '.title' ./ceremonies/$(echo $GITHUB_HEAD_REF | tr '[:upper:]' '[:lower:]')/p0tionConfig.json)
echo "Title: $title"
echo "TITLE=$title" >> $GITHUB_ENV
- name: Transform and compare
run: |
prefix=$(echo "${TITLE}" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -dc '[:alnum:]-\n\r')
echo "Converted Prefix: $prefix"
DIR_NAME="$(echo $GITHUB_HEAD_REF | tr '[:upper:]' '[:lower:]')"
echo "Dir name: $DIR_NAME"
if [ "$prefix" != $DIR_NAME ]; then
echo "Error: The ceremony artifacts directory name and ceremony prefix do not match!"
exit 1
else
echo "Directory name and ceremony prefix match."
fi