forked from neetcode-gh/leetcode
-
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.
- Loading branch information
Showing
1 changed file
with
44 additions
and
45 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,49 +1,48 @@ | ||
name: Build README | ||
|
||
on: | ||
# push: | ||
workflow_dispatch: | ||
on: | ||
# push: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
Build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [16.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
fetch-depth: 1 | ||
|
||
- name: Use Node.js (dependency) | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Use zsh (dependency) | ||
run: | | ||
sudo apt install zsh -y | ||
- name: Completion Table | ||
run: | | ||
zsh | ||
table=$(node ./.github/workflows/updateCompletionTable.js) | ||
echo $table | ||
awk -v r=$table "{gsub(/<completion-table \/>/,r)}1" .github/README_template.md > README.md | ||
- name: Check for modified files | ||
id: git-check | ||
run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) | ||
|
||
- name: Push | ||
if: steps.git-check.outputs.modified == 'true' | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Bot-A0" | ||
git add . | ||
git commit -am "📜 Update README table (🛠️ from Github Actions)" || true | ||
git push | ||
Build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [16.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
fetch-depth: 1 | ||
|
||
- name: Use Node.js (dependency) | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Use zsh (dependency) | ||
run: | | ||
sudo apt install zsh -y | ||
- name: Completion Table | ||
run: | | ||
table=$(node ./.github/workflows/updateCompletionTable.js) | ||
echo $table | ||
awk -v r=$table "{gsub(/<completion-table \/>/,r)}1" .github/README_template.md > README.md | ||
shell: /usr/bin/zsh -c {0} | ||
|
||
- name: Check for modified files | ||
id: git-check | ||
run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) | ||
|
||
- name: Push | ||
if: steps.git-check.outputs.modified == 'true' | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Bot-A0" | ||
git add . | ||
git commit -am "📜 Update README table (🛠️ from Github Actions)" || true | ||
git push |