sindresorhus/refined-github
The issue has been closed
Add GitHub Actions workflow to ensure new features are correctly named and documented #4493
fregante posted onGitHub
Add workflow to ensure that PRs with titles like add xyz feature
, include a file called xyz.tsx
and add a line with xyz
in readme.md
. If they aren't found in the diff, it should fail.
This would have prevented this: https://github.com/sindresorhus/refined-github/issues/4483#issuecomment-863889718
And also fixes: https://github.com/sindresorhus/refined-github/issues/4320#issuecomment-833301366
Possible starting point, pseudo-code:
name: New feature checker
on:
pull_request:
types: [opened, edited]
jobs:
checker:
runs-on: ubuntu-latest
if: contains(github.event.pr.title, 'Add') && contains(github.event.pr.title, 'feature')
steps:
- use: actions/checkout@v2
- name: Find feature name
id: feature
uses: AsasInnab/regex-action@v1
with:
regex_pattern: (?<=Add `)\w+(?=` feature)'
search_string: github.event.pr.title
- name: Has ${{ steps.feature.outputs.first_match }}.tsx been created?
uses: mudlabs/simple-diff@v1.2.0
with:
path: source/features/${{ steps.feature.outputs.first_match }}.tsx
- name: Has the file been imported
run: grep ${{ steps.feature.outputs.first_match }} source/refined-github.ts -q
- name: Has the feature been documented
run: grep ${{ steps.feature.outputs.first_match }} readme.md -q