forked from learningequality/kolibri
-
Notifications
You must be signed in to change notification settings - Fork 3
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 develop
- Loading branch information
Showing
28 changed files
with
425 additions
and
215 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,64 @@ | ||
name: Add new contributor to AUTHORS.md | ||
|
||
on: | ||
pull_request: | ||
types: [opened] | ||
pull_request_target: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
check_contributor_exists: | ||
update-authors: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
is_contributor_in_file: ${{ steps.check_contributor_step.outputs.exists }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
- name: Checkout develop branch | ||
uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: . | ||
ref: 'develop' | ||
fetch-depth: 0 | ||
persist-credentials: false | ||
|
||
- name: Check if contributor already exists | ||
id: check_contributor_step | ||
- name: Check if author is in AUTHORS.md | ||
id: check-author | ||
run: | | ||
exists=$(grep -c -F "${{ github.event.pull_request.user.login }}" AUTHORS.md || true) | ||
if [[ $exists -gt 0 ]]; then | ||
echo "exists=true" >> "$GITHUB_OUTPUT" | ||
GH_USER="${{ github.event.pull_request.user.login }}" | ||
# AUTHORS.md file already exist in repo, so can skip the conditional logic to create one if not exists | ||
if ! grep -q "| ${GH_USER} |" AUTHORS.md; then | ||
echo "new_author=true" >> $GITHUB_ENV | ||
else | ||
echo "exists=false" >> "$GITHUB_OUTPUT" | ||
echo "new_author=false" >> $GITHUB_ENV | ||
fi | ||
add_contributor: | ||
runs-on: ubuntu-latest | ||
needs: check_contributor_exists | ||
|
||
if: needs.check_contributor_exists.outputs.is_contributor_in_file == 'false' | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Git and checkout PR's branch | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
git fetch origin refs/pull/${{ github.event.number }}/head:pr | ||
git checkout pr | ||
- name: Get contributor's full name and append to AUTHORS.md file | ||
- name: Add author to AUTHORS.md if not present | ||
if: env.new_author == 'true' | ||
run: | | ||
username=${{ github.event.pull_request.user.login }} | ||
full_name=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/users/$username" | jq -r '.name') | ||
if [[ "$full_name" == "" || "$full_name" == "null" ]]; then | ||
full_name='-' | ||
GH_USER="${{ github.event.pull_request.user.login }}" | ||
AUTHOR_NAME=$(curl -s https://api.github.com/users/${GH_USER} | jq -r '.name') | ||
if [ -z "$AUTHOR_NAME" ]; then | ||
AUTHOR_NAME="-" | ||
fi | ||
echo "| $full_name | $username |" >> AUTHORS.md | ||
echo "| $AUTHOR_NAME | $GH_USER |" >> AUTHORS.md | ||
- name: Commit and push changes to the contributor's PR branch | ||
- name: Commit updated AUTHORS.md | ||
if: env.new_author == 'true' | ||
run: | | ||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git add AUTHORS.md | ||
git commit -m "Add ${{ github.event.pull_request.user.login }} to AUTHORS.md" | ||
git push origin pr:${{ github.event.pull_request.head.ref }} | ||
- name: GitHub App token | ||
if: env.new_author == 'true' | ||
uses: tibdex/github-app-token@v2 | ||
id: generate-token | ||
with: | ||
app_id: ${{ secrets.LE_BOT_APP_ID }} | ||
private_key: ${{ secrets.LE_BOT_PRIVATE_KEY }} | ||
|
||
- name: Push changes to develop | ||
if: env.new_author == 'true' | ||
uses: ad-m/github-push-action@v0.8.0 | ||
with: | ||
github_token: ${{ steps.generate-token.outputs.token }} | ||
branch: 'develop' |
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
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
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 was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
kolibri/core/assets/src/views/ContentRenderer/__tests__/DownloadButton.spec.js
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
2 changes: 1 addition & 1 deletion
2
kolibri/core/assets/src/views/ContentRenderer/__tests__/utils.spec.js
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 was deleted.
Oops, something went wrong.
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
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.