-
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.
feat: enable username inclusion as alternative to email addresses (#25)
* feat: enable username inclusion as alternative to email addresses * build: add test for usernames * docs: add username to example * docs(markdown): include and update examples * chore(meta): update code owners Co-authored-by: matfax <[email protected]>
- Loading branch information
Showing
7 changed files
with
84 additions
and
3 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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,6 +1,7 @@ | ||
/.github/* [email protected] | ||
/.github/workflows/* [email protected] | ||
/.gitignore [email protected] | ||
/Dockerfile [email protected] | ||
/README.md [email protected] | ||
/action.yml [email protected] | ||
/entrypoint.sh [email protected] |
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 |
---|---|---|
|
@@ -41,6 +41,55 @@ jobs: | |
run: | | ||
echo "::error:: the test file contained granular file references" | ||
exit 1 | ||
- name: verify lack of username | ||
continue-on-error: true | ||
run: | | ||
grep -q "@matfax" .github/CODEOWNERS.test | ||
echo "::set-env name=username::success" | ||
- name: fail if username is detected | ||
if: env.username == 'success' | ||
run: | | ||
echo "::error:: the generated file contained a username although the input was disabled" | ||
exit 1 | ||
- uses: actions/[email protected] | ||
with: | ||
name: ${{ github.job }}-owners | ||
path: .github/CODEOWNERS.test | ||
username: | ||
name: test with username | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout code | ||
uses: actions/[email protected] | ||
with: | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
ref: ${{ github.head_ref }} | ||
fetch-depth: 0 | ||
- name: cache docker layers | ||
uses: satackey/[email protected] | ||
with: | ||
key: docker-layers-${{ hashFiles('Dockerfile') }}-${{ hashFiles('entrypoint.sh') }} | ||
- name: update code owners | ||
uses: ./ | ||
with: | ||
path: .github/CODEOWNERS.test | ||
username: true | ||
- name: verify contents of generated file (file) | ||
run: | | ||
grep -q "^/.gitignore @matfax$" .github/CODEOWNERS.test | ||
- name: verify contents of generated file (folder) | ||
run: | | ||
grep -q "^/.github/\* @matfax" .github/CODEOWNERS.test | ||
- name: verify lack of email address | ||
continue-on-error: true | ||
run: | | ||
grep -q "[email protected]" .github/CODEOWNERS.test | ||
echo "::set-env name=email::success" | ||
- name: fail if email is detected | ||
if: env.email == 'success' | ||
run: | | ||
echo "::error:: the generated file still contained an email address" | ||
exit 1 | ||
- uses: actions/[email protected] | ||
with: | ||
name: ${{ github.job }}-owners | ||
|
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 |
---|---|---|
|
@@ -33,6 +33,7 @@ jobs: | |
uses: gofunky/[email protected] | ||
with: | ||
distribution: 25 | ||
username: true | ||
- name: commit changed files | ||
id: committed | ||
uses: stefanzweifel/[email protected] | ||
|
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
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 |
---|---|---|
|
@@ -33,6 +33,11 @@ The default uses the path to the `.github` directory. | |
By default, this action checks all files in the root, but groups recursive files into their parent directories. | ||
Set this input to any non-zero value (e.g. `true`) to enable full coverage of all recursive files. | ||
|
||
### username | ||
|
||
By default, this action uses the email addresses of users. | ||
Set this input to any non-zero value (e.g. `true`) to derive the GitHub usernames and use them instead. | ||
|
||
## Example | ||
|
||
This is a typical example for a pull request workflow. | ||
|
@@ -77,6 +82,7 @@ jobs: | |
uses: gofunky/[email protected] | ||
with: | ||
distribution: 25 | ||
username: true | ||
- name: commit changed files | ||
id: committed | ||
uses: stefanzweifel/[email protected] | ||
|
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
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