Skip to content

Fix Jasmine tests for new cloud upload button #6

Fix Jasmine tests for new cloud upload button

Fix Jasmine tests for new cloud upload button #6

Workflow file for this run

name: Check Draftlog
on:
pull_request:
types: [opened, reopened, synchronize, labeled, unlabeled, ready_for_review]
concurrency:
group: check-draftlog-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
contents: read
jobs:
check-draftlog:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- name: Check for a new draftlog entry
env:
PR_LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
set -euo pipefail
if echo "$PR_LABELS" | grep -q '"no-draftlog"'; then
echo "Skipping draftlog check: 'no-draftlog' label is set."
exit 0
fi
ADDED=$(git diff --name-only --diff-filter=A "$BASE_SHA"...HEAD -- 'draftlogs/*.md' | grep -v '^draftlogs/README\.md$' || true)
if [ -z "$ADDED" ]; then
echo "::error::No new draftlog entry was added under draftlogs/."
echo ""
echo "Most PRs should add a markdown file under draftlogs/ for the next CHANGELOG."
echo "See draftlogs/README.md for the filename convention."
echo ""
echo "If this PR genuinely does not need a changelog entry (e.g. CI-only,"
echo "internal refactor, docs typo), add the 'no-draftlog' label to this PR."
exit 1
fi
INVALID_NAMES=$(echo "$ADDED" | grep -vE '^draftlogs/[0-9]+_(fix|add|remove|change|deprecate)\.md$' || true)
if [ -n "$INVALID_NAMES" ]; then
echo "::error::Invalid draftlog filename(s):"
echo "$INVALID_NAMES" | sed 's/^/ - /'
echo ""
echo "Expected pattern: draftlogs/<number>_(fix|add|remove|change|deprecate).md"
echo "See draftlogs/README.md for details."
exit 1
fi
MISSING_LINK=""
while IFS= read -r f; do
[ -z "$f" ] && continue
if ! grep -qE '\[\[#[0-9]+\]\(https://github\.com/plotly/plotly\.js/pull/[0-9]+\)\]' "$f"; then
MISSING_LINK="$MISSING_LINK$f"$'\n'
fi
done <<< "$ADDED"
if [ -n "$MISSING_LINK" ]; then
echo "::error::Draftlog entry(ies) missing a PR link:"
printf '%s' "$MISSING_LINK" | sed 's/^/ - /'
echo ""
echo "Each entry must include a link in the form:"
echo " [[#1234](https://github.com/plotly/plotly.js/pull/1234)]"
echo "See draftlogs/README.md for an example."
exit 1
fi
echo "Found new draftlog entry(ies):"
echo "$ADDED" | sed 's/^/ - /'