Skip to content

Workflow to check we have a paper trail on répertoire changes #8

Workflow to check we have a paper trail on répertoire changes

Workflow to check we have a paper trail on répertoire changes #8

Workflow file for this run

name: Pipeline
on:
pull_request:
branches: ['*']
types: [opened, synchronize, reopened, labeled, ready_for_review, converted_to_draft]
jobs:
labels-for-repertoire-changes:
name: Labels for repertoire changes
runs-on: ubuntu-latest
steps:
- name: Checkout merged UnicodeData.txt
uses: actions/checkout@v3
with:
path: merged
sparse-checkout: unicodetools/data/ucd/dev/UnicodeData.txt
- name: Checkout base UnicodeData.txt
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.base.sha }}
path: base
sparse-checkout: unicodetools/data/ucd/dev/UnicodeData.txt
- name: Compare repertoire
id: compare-repertoire
run: |
sed 's/^\([^;]*;[^;]*\);.*$/\1/' merged/unicodetools/data/ucd/dev/UnicodeData.txt > merged-repertoire.txt
sed 's/^\([^;]*;[^;]*\);.*$/\1/' base/unicodetools/data/ucd/dev/UnicodeData.txt > base-repertoire.txt
if diff base-repertoire.txt merged-repertoire.txt
then echo "changed=false" >> "$GITHUB_OUTPUT"
else echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Check pipeline labels
if: steps.compare-repertoire.outputs.changed == 'true'
run: |
cat $GITHUB_EVENT_PATH |
python3 <<EOF
import sys, json
labels = json.load(sys.stdin)['pull_request']['labels']
for label in labels:
if label.startswith('pipeline-'):
print("Labeled", label)
exit(0)
print("::error file=unicodetools/data/ucd/dev/UnicodeData.txt,title=Missing pipeline label::PRs for character additions must have a pipeline label")
exit(1)
EOF