-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
81 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,13 @@ | ||
#!/usr/bin/env bash | ||
git config --global user.email "$1" | ||
shift | ||
git config --global user.name "$1" | ||
shift | ||
message="$1" | ||
shift | ||
if [ $(git status --porcelain "$@" | egrep '^ M' | wc -l) -gt 0 ]; then | ||
git add "$@" | ||
git commit -m "$message" | ||
git push || git pull --rebase | ||
git push | ||
fi |
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 @@ | ||
#!/usr/bin/env bash | ||
dir=${1:-$PWD} | ||
dates=($(git log --date=format:%Y --pretty=format:'%ad' --reverse | sort | uniq)) | ||
if [ "${#dates[@]}" -eq 1 ]; then | ||
datestr="${dates}" | ||
else | ||
datestr="${dates}-${dates[${#dates[@]}-1]}" | ||
fi | ||
|
||
stripDate='s/^((.*)Copyright\b(.*?))((?:,\s*)?(([0-9]{4}\s*-\s*[0-9]{4})|(([0-9]{4},\s*)*[0-9]{4})))(?:,)?\s*(.*)\n$/$1$9\n/g' | ||
addDate='s/^.*Copyright(?:\s*\(c\))? /Copyright \(c\) '$datestr' /g' | ||
for l in $dir/LICENSE*; do | ||
perl -pi -e "$stripDate" $l | ||
perl -pi -e "$addDate" $l | ||
done |
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,37 @@ | ||
name: "various tidying up tasks to silence nagging" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
makework: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v2.1.4 | ||
with: | ||
node-version: 16.x | ||
- name: put repo in package.json | ||
run: node .github/workflows/package-json-repo.js | ||
- name: check in package.json if modified | ||
run: | | ||
bash -x .github/workflows/commit-if-modified.sh \ | ||
"package-json-repo-bot@example.com" \ | ||
"package.json Repo Bot" \ | ||
"chore: add repo to package.json" \ | ||
package.json package-lock.json | ||
- name: put all dates in license copyright line | ||
run: bash .github/workflows/copyright-year.sh | ||
- name: check in licenses if modified | ||
run: | | ||
bash .github/workflows/commit-if-modified.sh \ | ||
"license-year-bot@example.com" \ | ||
"License Year Bot" \ | ||
"chore: add copyright year to license" \ | ||
LICENSE* |
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,16 @@ | ||
#!/usr/bin/env node | ||
|
||
const pf = require.resolve(`${process.cwd()}/package.json`) | ||
const pj = require(pf) | ||
|
||
if (!pj.repository && process.env.GITHUB_REPOSITORY) { | ||
const fs = require('fs') | ||
const server = process.env.GITHUB_SERVER_URL || 'https://github.com' | ||
const repo = `${server}/${process.env.GITHUB_REPOSITORY}` | ||
pj.repository = repo | ||
const json = fs.readFileSync(pf, 'utf8') | ||
const match = json.match(/^\s*\{[\r\n]+([ \t]*)"/) | ||
const indent = match[1] | ||
const output = JSON.stringify(pj, null, indent || 2) + '\n' | ||
fs.writeFileSync(pf, output) | ||
} |