-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from vusion/task-404-cw_echarts_library-hanshi…
…jie-240226 Task 404 auto changelog support hanshijie 240226
- Loading branch information
Showing
14 changed files
with
38,158 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Generate Commit on Comment with Pull Request | ||
|
||
on: | ||
issue_comment: | ||
types: [created] | ||
|
||
permissions: | ||
pull-requests: write | ||
contents: write | ||
issues: write | ||
|
||
jobs: | ||
generate-commit: | ||
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/generate-commit') | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# - name: Get branch name | ||
# id: branch_name | ||
# run: | | ||
# branch_name=$(curl -s -H "Authorization: token ${{ github.token }}" ${{github.event.issue.pull_request.url}} | jq -r '.head.ref') | ||
# echo $branch_name | ||
- name: Checkout | ||
uses: actions/checkout/@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Add comment with workflow run link | ||
run: | | ||
COMMENT_BODY="The workflow run can be found at $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" | ||
curl -d '{"body":"'"$COMMENT_BODY"'"}' -H "Content-Type: application/json" -H "Authorization: Bearer ${{github.token}}" -X POST "https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ github.event.issue.number }}/comments" | ||
env: | ||
GITHUB_SERVER_URL: ${{ github.server_url }} | ||
GITHUB_REPOSITORY: ${{ github.repository }} | ||
GITHUB_RUN_ID: ${{ github.run_id }} | ||
|
||
- name: Git Identity | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY | ||
branch_name=$(curl -s -H "Authorization: token ${{ github.token }}" ${{github.event.issue.pull_request.url}} | jq -r '.head.ref') | ||
git checkout -b $branch_name origin/$branch_name | ||
env: | ||
GITHUB_TOKEN: ${{ github.token}} | ||
|
||
- name: Setup Nodejs | ||
uses: actions/setup-node@v3 | ||
with: | ||
cache: 'yarn' | ||
node-version: 16 | ||
|
||
- name: Install yarn | ||
run: npm install -g yarn@v1 | ||
|
||
- name: Install Dep | ||
run: | | ||
yarn install --frozen-lockfile | ||
- name: Update Pull Request | ||
run: | | ||
yarn changelog:comment | ||
env: | ||
GITHUB_TOKEN: ${{ github.token}} | ||
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} |
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,56 @@ | ||
name: Update Pull Request Body | ||
|
||
on: | ||
pull_request: | ||
branches: main | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
jobs: | ||
update-pr: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check if commit is from CI | ||
run: | | ||
if [[ "${{ github.event.head_commit.committer.username }}" == "github-actions[bot]" ]]; then | ||
echo "Commit is from CI, skipping the build..." | ||
exit 78 | ||
else | ||
echo "Commit is not from CI, continuing with the build..." | ||
fi | ||
- name: Checkout | ||
uses: actions/checkout/@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Git Identity | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY | ||
git checkout -b main origin/main | ||
git checkout '${{github.event.pull_request.head.ref}}' | ||
env: | ||
GITHUB_TOKEN: ${{ github.token}} | ||
|
||
- name: Setup Nodejs | ||
uses: actions/setup-node@v3 | ||
with: | ||
cache: 'yarn' | ||
node-version: 16 | ||
|
||
- name: Install yarn | ||
run: npm install -g yarn@v1 | ||
|
||
- name: Install Dep | ||
run: | | ||
yarn install --frozen-lockfile | ||
- name: Update Pull Request | ||
run: | | ||
yarn changelog:ci | ||
env: | ||
GITHUB_TOKEN: ${{ github.token}} | ||
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} |
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 |
---|---|---|
|
@@ -7,7 +7,8 @@ yarn-error.log* | |
|
||
# Locks | ||
# package-lock.json | ||
yarn.lock | ||
*/**/yarn.lock | ||
*/yarn.lock | ||
|
||
# Cache | ||
.DS_Store | ||
|
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,13 @@ | ||
{ | ||
"name": "cloud-ui-materials", | ||
"private": "true", | ||
"scripts": { | ||
"changelog": "node scripts/changelog.js", | ||
"changelog:ci": "node scripts/changelog.js from-ci", | ||
"changelog:comment": "node scripts/changelog.js from-comment" | ||
}, | ||
"dependencies": { | ||
"lodash.mergewith": "^4.6.2", | ||
"node-fetch": "2" | ||
} | ||
} |
Oops, something went wrong.