-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(template): sync with ahmadnassri/template-node-lib
- Loading branch information
Ahmad Nassri
committed
Mar 4, 2021
1 parent
2cba038
commit 192eff2
Showing
1 changed file
with
54 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# ----------------------------------------------------------- # | ||
# Note: this file originates in ahmadnassri/template-template # | ||
# ----------------------------------------------------------- # | ||
|
||
name: readme | ||
|
||
on: | ||
push: | ||
branches: master | ||
paths: | ||
- docs/** | ||
- colophon.yml | ||
- .github/workflows/readme.yml | ||
|
||
jobs: | ||
readme: | ||
timeout-minutes: 5 | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: docker://pandoc/core:2.11.4 | ||
with: | ||
args: >- | ||
--metadata-file=colophon.yml | ||
--template=docs/README.template | ||
--output=README.md | ||
--from=gfm | ||
--to=gfm | ||
--fail-if-warnings | ||
--wrap=preserve | ||
--reference-links | ||
docs/README.md | ||
- uses: actions/github-script@v3 | ||
with: | ||
github-token: ${{secrets.GH_TOKEN}} | ||
script: | | ||
const { readFileSync } = require('fs') | ||
const path = 'README.md' | ||
const content = readFileSync(`${process.env.GITHUB_WORKSPACE}/${path}`) | ||
const { data } = await github.repos.getContent({ ...context.repo, path }) | ||
if (Buffer.from(data.content, 'base64').compare(content) === 0) return | ||
await github.repos.createOrUpdateFileContents({...context.repo, path, | ||
sha: data.sha, | ||
message: 'docs(readme): update readme', | ||
content: content.toString('base64') | ||
}) |