forked from learningequality/kolibri-design-system
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'learningequality:develop' into main
- Loading branch information
Showing
19 changed files
with
430 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,32 @@ | ||
name: Check Changelog.md | ||
name: Check PR for Changelog | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
types: [opened, synchronize, edited, reopened] | ||
|
||
jobs: | ||
check-changelog: | ||
runs-on: ubuntu-latest | ||
permissions: write-all | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Fetch changed files | ||
id: fetch-changed-files | ||
run: | | ||
response=$(gh api \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
repos/${owner}/${REPO}/pulls/${PULL_NUMBER}/files) | ||
echo "$response" | jq '.' > response.json | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
owner: ${{ github.repository_owner }} | ||
REPO: ${{ github.event.repository.name }} | ||
PULL_NUMBER: ${{ github.event.pull_request.number }} | ||
- name: Check if Changelog.md is changed | ||
run: | | ||
if [[ $(jq '.[].filename' response.json) == *"CHANGELOG.md"* ]]; then | ||
echo "Changelog.md is changed" | ||
exit 0 | ||
else | ||
echo "Changelog.md is not changed" | ||
exit 1 | ||
fi | ||
check-description: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Check PR Description | ||
id: check_description | ||
run: | | ||
description=$(jq -r ".pull_request.body" "$GITHUB_EVENT_PATH" | awk '/## Changelog/{flag=1; next} /##/{flag=0} flag' | grep -oP '(?<=- \*\*Description:\*\* ).*' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') | ||
echo "$description" | ||
default_description="Summary of change(s)" | ||
if [ -n "$description" ] && [ "$description" != "$default_description" ]; then | ||
echo "containsChangelog=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "containsChangelog=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Results | ||
run: | | ||
if [[ "${{ steps.check_description.outputs.containsChangelog }}" == "true" || "${{ github.event.pull_request.user.login }}" == "dependabot[bot]" ]]; then | ||
echo "PR contains Changelog section/ PR made by Dependabot" | ||
exit 0 | ||
else | ||
echo "Changelog section is missing or does not contain the required details" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Update Changelog.md | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
update-changelog: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.base.ref }} | ||
fetch-depth: 0 | ||
# Prevent later git operations from reusing the same authentication | ||
persist-credentials: false | ||
|
||
- name: Extract and update Changelog | ||
id: modify-changelog | ||
shell: python | ||
run: | | ||
import re | ||
if "${{ github.event.pull_request.user.login }}" == "dependabot[bot]": | ||
changelog = " - **Description:** ${{ github.event.pull_request.title }}\n - **Products impact:** Dev Dependency upgrade\n - **Addresses:** -\n - **Components:** -\n - **Breaking:** -\n - **Impacts a11y:** -\n - **Guidance:** -" | ||
else: | ||
description = """${{ github.event.pull_request.body }}""" | ||
capture = re.compile("<!-- \[DO NOT REMOVE-USED BY GH ACTION\] CHANGELOG START -->\s+<!--(\n|.)+?(?=- \*\*Description)(?P<body>(\n|.)+?(?=<!-- \[DO NOT REMOVE-USED BY GH ACTION\] CHANGELOG END -->))") | ||
match = capture.search(description) | ||
changelog = match.groupdict()["body"].strip() | ||
final_changelog = "<!-- [DO NOT REMOVE-USED BY GH ACTION] PASTE CHANGELOG -->\n\n" | ||
pr_number = "${{ github.event.pull_request.number }}" | ||
pr_link = "[#{}]".format(pr_number) | ||
pr_link_ref = pr_link + ": ${{ github.event.pull_request.html_url }}" | ||
for changeline in changelog.splitlines(): | ||
changeline = changeline.strip() | ||
if not changeline: | ||
continue | ||
if changeline.startswith("- **Description:**"): | ||
final_changelog += "\n" + "- " + pr_link + "\n" | ||
final_changelog += " " + changeline + "\n" | ||
if changeline.startswith("- **Guidance:**"): | ||
final_changelog += "\n" + pr_link_ref + "\n" | ||
with open("CHANGELOG.md", "r") as f: | ||
current_changelog = f.read() | ||
new_changelog = current_changelog.replace("<!-- [DO NOT REMOVE-USED BY GH ACTION] PASTE CHANGELOG -->", final_changelog, 1) | ||
with open("CHANGELOG.md", "w") as f: | ||
f.write(new_changelog) | ||
- uses: tibdex/github-app-token@v1 | ||
id: generate-token | ||
with: | ||
app_id: ${{ secrets.LE_BOT_APP_ID }} | ||
private_key: ${{ secrets.LE_BOT_PRIVATE_KEY }} | ||
- name: Commit updated CHANGELOG.md | ||
run: | | ||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git add CHANGELOG.md | ||
git commit -m "Update CHANGELOG.md for PR #${{ github.event.pull_request.number }}" | ||
- name: Push changes | ||
uses: ad-m/[email protected] | ||
with: | ||
github_token: ${{ steps.generate-token.outputs.token }} | ||
branch: ${{ github.event.pull_request.base.ref }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<template> | ||
|
||
<DocsPageTemplate apiDocs> | ||
<DocsPageSection title="Overview" anchor="#overview"> | ||
<p>Use <code>KOverlay</code> to move an element from its original place in the DOM to the overlay container element <code>#k-overlay</code> that is inserted to an application's document body automatically <DocsInternalLink href="/installation#install-plugin" text="during the KDS installation process" />. This is often useful for modals, tooltips, dropdowns, or other elements that should appear on top of other content.</p> | ||
</DocsPageSection> | ||
|
||
<DocsPageSection title="Usage" anchor="#usage"> | ||
<p>First, check whether you need <code>KOverlay</code>. Some KDS components already utilize it internally and you only need to instruct them to activate it, typically via the <code>appendToOverlay</code> prop.</p> | ||
|
||
<p>If you need to use <code>KOverlay</code>, simply wrap an element or a component in it:</p> | ||
|
||
<DocsShowCode language="html"> | ||
<KOverlay> | ||
<YourComponent /> | ||
</KOverlay> | ||
</DocsShowCode> | ||
</DocsPageSection> | ||
|
||
<DocsPageSection title="Related" anchor="#related"> | ||
<ul> | ||
<li> | ||
<DocsInternalLink href="/installation#install-plugin" text="KDS installation step" /> that attaches the overlay container element <code>#k-overlay</code> to an application's document body | ||
</li> | ||
</ul> | ||
</DocsPageSection> | ||
</DocsPageTemplate> | ||
|
||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.