Skip to content

Commit 914df9e

Browse files
committed
New version of the template, now adding Remark to check for broken links!
1 parent e0c0e16 commit 914df9e

18 files changed

+1549
-441
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Check for broken Markdown links
2+
3+
on:
4+
schedule:
5+
- cron: 0 0 * * *
6+
workflow_dispatch: {}
7+
8+
jobs:
9+
check-links:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-node@v3
14+
with:
15+
node-version: 19.x
16+
- name: Install dependencies
17+
run: yarn
18+
- name: Run link check
19+
run: yarn check-links

.github/workflows/main.yml renamed to .github/workflows/ci.yml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,44 @@ jobs:
1717
node-version: 19.x
1818
always-auth: true
1919

20+
- name: Check commit message
21+
id: commit
22+
run: |
23+
COMMIT_MSG=$(/usr/bin/git log --format=%B -n 1 HEAD)
24+
STRING=$(echo $COMMIT_MSG | (grep -E "infra:|docs:|lint:|code-style:" || echo ''))
25+
26+
if [ -z "$STRING" ]; then
27+
echo "IS_RELEASE_COMMIT=1" >> $GITHUB_OUTPUT
28+
echo "IS_RELEASE_COMMIT=1" >> $GITHUB_ENV
29+
else
30+
echo "This commit will NOT trigger a release."
31+
32+
echo "IS_RELEASE_COMMIT=0" >> $GITHUB_OUTPUT
33+
echo "IS_RELEASE_COMMIT=0" >> $GITHUB_ENV
34+
fi
35+
2036
- name: Install dependencies
2137
run: yarn
2238

39+
- name: Validate Markdown links
40+
run: yarn check-links
41+
2342
- name: Validate package.json
2443
run: yarn validate-package-json
2544

2645
- name: Run ESLint
46+
if: env.IS_RELEASE_COMMIT == '1'
2747
run: yarn lint
2848

2949
- name: Build source code
50+
if: env.IS_RELEASE_COMMIT == '1'
3051
run: yarn build
3152

3253
- name: Run test suites
54+
if: env.IS_RELEASE_COMMIT == '1'
3355
run: yarn test
3456
release:
57+
if: needs.test.outputs.IS_RELEASE_COMMIT == '1'
3558
permissions:
3659
contents: write
3760
needs: test
@@ -94,18 +117,11 @@ jobs:
94117
run: yarn
95118
- name: Build code
96119
run: yarn build
97-
# For whatever reason, I have to have a separate secret set to a GitHub PAT to publish
98-
# to GPR -- GITHUB_TOKEN won't work, even if I specify:
99-
#
100-
# permissions:
101-
# packages: write
102-
#
103-
# at the top of the workflow/job.
120+
104121
- name: Set authentication token
105122
run: |
106123
npm set //npm.pkg.github.com/:_authToken ${{ secrets.GPR_AUTH_TOKEN }}
107-
# This step here is a weird workaround to the difference between my NPM and GitHub
108-
# usernames. You can delete it if it's causing trouble or it's unnecessary.
124+
109125
- name: Get ready to publish to GPR
110126
run: |
111127
jq ".name = \"@$REPO\"" package.json > temp.json && mv temp.json package.json

.github/workflows/issue-welcome.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ permissions:
77
issues: write
88
jobs:
99
welcome-author:
10+
continue-on-error: true
1011
runs-on: ubuntu-latest
1112
steps:
1213
- name: Say hi

.github/workflows/pr-build-failed.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
type: string
1111
jobs:
1212
report-pr-build-failed:
13+
continue-on-error: true
1314
permissions:
1415
pull-requests: write
1516
runs-on: ubuntu-latest

.github/workflows/pr-check.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,44 @@ jobs:
2424
with:
2525
node-version: 16.x
2626
- name: Clone the main repo
27-
run: cd .. && sudo /usr/bin/git clone https://github.com/${{ github.repository }} main && cd -
28-
- name: Check if the PR is acceptable
2927
run: |
30-
diff -q ./tests/ ../main/tests
31-
diff -q ./.github/ ../main/.github
32-
- name: Copy test suites from main repo to PR
33-
run: cp ../main/tests/*.* tests/
28+
cd ..
29+
sudo /usr/bin/git clone https://github.com/${{ github.repository }} main
30+
(cd -) > /dev/null
31+
32+
- name: Pre-run modified files validation
33+
run: |
34+
sudo chmod +x scripts/validate-diff.sh
35+
scripts/validate-diff.sh .github ../main/.github
36+
scripts/validate-diff.sh LICENSE ../main/LICENSE
37+
scripts/validate-diff.sh .gitignore ../main/.gitignore
38+
scripts/validate-diff.sh .prettierrc ../main/.prettierrc
39+
scripts/validate-diff.sh .eslintrc.json ../main/.eslintrc.json
40+
scripts/validate-diff.sh tsconfig.json ../main/tsconfig.json
41+
scripts/validate-diff.sh SECURITY.md ../main/SECURITY.md
42+
scripts/validate-diff.sh CONTRIBUTING.md ../main/CONTRIBUTING.md
43+
scripts/validate-diff.sh CODE_OF_CONDUCT.md ../main/CODE_OF_CONDUCT.md
44+
3445
- name: Get rid of the main repo's clone
3546
run: sudo rm -rf ../main
36-
- name: Validate package.json
37-
run: yarn validate-package-json
3847
- name: Install dependencies
3948
run: yarn
49+
50+
- name: Validate package.json
51+
run: yarn validate-package-json
52+
53+
- name: Validate Markdown links
54+
run: yarn check-links
55+
4056
- name: Run ESLint
4157
run: yarn lint
58+
4259
- name: Build code
4360
run: yarn build
61+
4462
- name: Run main test suites
4563
run: yarn test
64+
4665
- name: Report build failed (if any)
4766
if: failure()
4867
uses: ./.github/workflows/pr-build-failed.yml

.github/workflows/pr-welcome.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66

77
jobs:
88
say-hi:
9+
continue-on-error: true
910
permissions:
1011
pull-requests: write
1112
runs-on: ubuntu-latest

.remarkrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"plugins": [
3+
"gfm",
4+
"validate-links"
5+
]
6+
}

CODE_OF_CONDUCT.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
In the interest of fostering an open and welcoming environment, as
66
the maintainer, I pledge to make participation in my project and
77
our community a harassment-free experience for everyone, regardless of age, body
8-
size, disability, ethnicity, level of experience, education,
9-
socio-economic status, nationality, personal appearance, race,
8+
size, disability, ethnicity, level of experience, education,
9+
socio-economic status, nationality, personal appearance, race,
1010
or religion.
1111

1212
## My Standards
@@ -60,6 +60,7 @@ All complaints will be reviewed and investigated promptly and fairly.
6060

6161
I'm obligated to respect the privacy and security of the
6262
reporter of any incident.
63+
6364
## Enforcement Guidelines
6465

6566
I will follow these Community Impact Guidelines in determining
@@ -112,12 +113,12 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
112113
version 2.0, available at
113114
<https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.
114115

115-
Community Impact Guidelines were inspired by
116+
Community Impact Guidelines were inspired by
116117
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
117118

118119
For answers to common questions about this code of conduct, see the FAQ at
119-
<https://www.contributor-covenant.org/faq>. Translations are available
120+
<https://www.contributor-covenant.org/faq>. Translations are available
120121
at <https://www.contributor-covenant.org/translations>.
121122

122123
[homepage]: https://www.contributor-covenant.org
123-
[Mozilla CoC]: https://github.com/mozilla/diversity
124+
[Mozilla CoC]: https://github.com/mozilla/diversity

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ You'll find a readme template inside this file.
66
In order for the CI workflow's publishing jobs to execute successfully, you must have two
77
Actions secrets set up -- `NPM_AUTH_TOKEN` and `GPR_AUTH_TOKEN`.
88
They're set to a default dummy value "your-token-here".
9-
You might want to check the [YAML Actions workflow](.github/workflows/main.yml) for hints
9+
You might want to check the [YAML Actions workflow](.github/workflows/ci.yml) for hints
1010
and information you may want or need to know.
1111

1212
## Template features
@@ -17,7 +17,6 @@ and information you may want or need to know.
1717
- Automatic testing: Jest.
1818
- TypeScript 4.9.5 for built-in type definitions and support for compiling to ES3.
1919
- ESLint and Prettier.
20-
- A pre-commit hook for prettifying and validation, so you don't get embarrased if your PR's CI fails :)
2120
- Security policy and contribution guidelines.
2221

2322
- Self-made scripts for verification of package.json and creation of an ESM wrapper
@@ -38,7 +37,7 @@ and information you may want or need to know.
3837
[![License][license badge]][repo url]
3938
[![Bundlephobia stats][bundlephobia badge]][bundlephobia url]
4039
41-
[workflow badge]: https://github.com/<author>/<repo>/actions/workflows/main.yml/badge.svg
40+
[workflow badge]: https://github.com/<author>/<repo>/actions/workflows/ci.yml/badge.svg
4241
[npm badge]: https://img.shields.io/npm/v/@<author>/<repo>
4342
[stars badge]: https://img.shields.io/github/stars/<author>/<repo>.svg
4443
[license badge]: https://img.shields.io/github/license/<author>/<repo>.svg

SECURITY.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,31 @@
22

33
## Reporting a Vulnerability
44

5-
**First see the [Code of Conduct](CODE_OF_CONDUCT.md) and [Contribution instructions](CONTRIBUTE.md)!**
5+
**First see the [Code of Conduct](CODE_OF_CONDUCT.md) and [Contribution instructions](CONTRIBUTING.md)!**
66

77
If you believe you have discovered a security vulnerability in this project, please email me at <[email protected]>. Please include a detailed description of the vulnerability and steps to reproduce it, along with any relevant information on the environment and configuration where the vulnerability was discovered. Please do not disclose the vulnerability publicly until it has been addressed by me.
88

99
## Scope
10+
1011
This security policy applies to all versions of the project, including any pre-release or beta versions. I will make reasonable efforts to address vulnerabilities in a timely manner, but I can make no guarantees whatsoever regarding the timeline or process for addressing vulnerabilities.
1112

1213
## Responsible Disclosure
14+
1315
I am committed to addressing security vulnerabilities in a responsible manner, and will follow the principles of responsible disclosure:
1416

1517
- I will acknowledge receipt of your vulnerability report as soon as possible.
1618
- I will provide an estimated timeline for addressing the vulnerability and keep you informed of any changes to the timeline.
1719
- I will provide credit to you in the release notes for any vulnerability that you report, unless you prefer to remain anonymous.
1820
- I will not take legal action against you or disclose your identity to any third party without your consent, unless required by law.
21+
1922
## Vulnerability Severity
23+
2024
I will evaluate the severity of reported vulnerabilities. The severity of the vulnerability will determine the priority for addressing it.
2125

2226
## Patching
27+
2328
I will try my best to provide patches for all vulnerabilities that are confirmed and accepted. I will make reasonable efforts to provide patches in a timely manner, and will prioritize high-severity vulnerabilities. I may provide workarounds or mitigation advice in cases where a patch is not immediately available.
2429

2530
## Public Disclosure
26-
I will coordinate with you to determine an appropriate timeline for public disclosure of the vulnerability, taking into account the severity of the vulnerability, the availability of patches, and any other relevant factors. I will make a best effort to release a patch for the vulnerability before publicly disclosing it, and will coordinate with other affected parties if necessary.
31+
32+
I will coordinate with you to determine an appropriate timeline for public disclosure of the vulnerability, taking into account the severity of the vulnerability, the availability of patches, and any other relevant factors. I will make a best effort to release a patch for the vulnerability before publicly disclosing it, and will coordinate with other affected parties if necessary.

0 commit comments

Comments
 (0)