-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #244 from DSACMS/nat/repo-scaffolder-gh-actions
Workflows: Added auto-changelog, gitleaks, and contributors-list GH actions + docs
- Loading branch information
Showing
9 changed files
with
168 additions
and
47 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,13 @@ | ||
name: Changelog | ||
on: | ||
release: | ||
types: | ||
- created | ||
jobs: | ||
changelog: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Auto Generate changelog" | ||
uses: heinrichreimer/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} |
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,69 @@ | ||
name: Update Contributors Information | ||
|
||
on: | ||
workflow_dispatch: {} | ||
schedule: | ||
# Weekly on Saturdays. | ||
- cron: "30 1 * * 6" | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
update-contributors: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Update contributor list | ||
id: contrib_list | ||
uses: akhilmhdh/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
readme_path: MAINTAINERS.md | ||
use_username: false | ||
commit_message: "update contributors information" | ||
|
||
- name: Get contributors count | ||
id: get_contributors | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
run: | | ||
OWNER=$(echo $GITHUB_REPOSITORY | cut -d'/' -f1) | ||
REPO=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2) | ||
QUERY='query { repository(owner: \"'"$OWNER"'\", name: \"'"$REPO"'\") { collaborators { totalCount } } }' | ||
CONTRIBUTORS=$(gh api \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
"/repos/$OWNER/$REPO/contributors?per_page=100" | \ | ||
jq '[.[] | select(.type != "Bot" and (.login | test("\\[bot\\]$") | not) and (.login | test("-bot$") | not))] | length') | ||
echo "Total contributors: $CONTRIBUTORS" | ||
echo "contributors=$CONTRIBUTORS" >> $GITHUB_OUTPUT | ||
- name: Update MAINTAINERS.md | ||
run: | | ||
CONTRIBUTORS="${{ steps.get_contributors.outputs.contributors }}" | ||
perl -i -pe 's/(<!--CONTRIBUTOR COUNT START-->).*?(<!--CONTRIBUTOR COUNT END-->)/$1 '"$CONTRIBUTORS"' $2/' MAINTAINERS.md | ||
git config user.name 'github-actions[bot]' | ||
git config user.email 'github-actions[bot]@users.noreply.github.com' | ||
git add MAINTAINERS.md | ||
git commit -m "update contributors count to $CONTRIBUTORS" || exit 0 | ||
- name: Push protected | ||
uses: CasperWA/push-protected@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
branch: main |
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,15 @@ | ||
name: Check for Secrets | ||
on: | ||
pull_request: | ||
push: | ||
|
||
jobs: | ||
scan-for-secrets: | ||
name: Run gitleaks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: { fetch-depth: 0 } | ||
|
||
- name: Check for GitLeaks | ||
uses: gacts/gitleaks@v1 |
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
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
Oops, something went wrong.