Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
b6eef07
docs: updates on documentation
Jan 28, 2021
a1b927a
docs: updates on documentation
Jan 29, 2021
11cc7cf
docs: updates on documentation
Jan 30, 2021
a584eb4
docs: updates on documentation
Jan 31, 2021
f28ebdc
docs: updates on documentation
Feb 1, 2021
6b11b64
docs: updates on documentation
Feb 1, 2021
e348400
docs: updates on documentation
Feb 1, 2021
e376536
docs: updates on documentation
Feb 1, 2021
df03054
docs: updates on workflows
Feb 3, 2021
008e238
docs: updates on documentation
Feb 4, 2021
22c0eb9
docs: updates on documentation
Feb 6, 2021
7a2e406
docs: updates on documentation
Feb 6, 2021
0a47919
docs: updates on documentation
Feb 10, 2021
9ea0dfe
docs: updates on documentation
Feb 10, 2021
440d33f
docs: updates on documentation
Feb 26, 2021
9c5c45c
docs: updates on documentation
Apr 6, 2021
0061eea
docs: updates on documentation
Apr 6, 2021
cf05d94
docs: updates on documentation
Apr 23, 2021
0c857f7
docs: updates on documentation
Apr 23, 2021
195f57d
Updated CHANGELOG.md
github-actions[bot] Apr 25, 2021
bf9512a
docs: updates on documentation
May 14, 2021
7f2c992
Added info on workflows
Jul 16, 2021
97eea07
Added info on workflows
Jul 16, 2021
74a5c1d
Added info on workflows
Jul 18, 2021
62f11a6
Added info on workflows
Jul 18, 2021
6834071
Added info on workflows
Jul 20, 2021
c94f8d6
Added info on workflows
Jul 27, 2021
697eedb
Added info on workflows
Jul 29, 2021
5ce07c7
Added info on workflows
Jul 29, 2021
fd3a8b2
Added info on workflows
Jul 29, 2021
2f7c772
Added info on workflows
Aug 7, 2021
a4caefd
Update son files
Nov 20, 2021
1a7f0e7
Updates on files
Nov 26, 2021
6af90e8
Updates on files
Dec 2, 2021
a89cd3c
Updates on files
Dec 3, 2021
0c01fe4
Updates on files
Dec 4, 2021
a838bfb
Updates on files
Dec 18, 2021
ecd4cca
Updates on files
Dec 21, 2021
f14ad34
Updates on files
Mar 26, 2022
46476a5
Updates on docs
AlexRogalskiy Jun 14, 2022
d7173ec
[nodoc] Update Changelog\n\nAdded CHANGELOG file
Jun 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .bettercodehub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
component_depth: 6
default_excludes: true
languages:
- java
- kotlin
8 changes: 8 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version = 1

[[analyzers]]
name = "java"
enabled = true

[analyzers.meta]
runtime_version = "11"
3 changes: 3 additions & 0 deletions .github/dco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Disable sign-off chcecking for members of the Gradle GitHub organization
require:
members: false
21 changes: 21 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name-template: $NEXT_MINOR_VERSION
tag-template: v$NEXT_MINOR_VERSION

categories:
- title: 🚀 New features and improvements
labels:
- enhancement
- title: 🐛 Bug Fixes
labels:
- bug
- title: 🚦 Internal changes
labels:
- internal

exclude-labels:
- no-changelog
- duplicate
- invalid

template: |
$CHANGES
27 changes: 27 additions & 0 deletions .github/scripts/close-pending.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
MESSAGE=$(cat $SCRIPT_DIR/closing-message.txt)

while IFS= read -r number &&
IFS= read -r title; do
echo "Closing PR ($number): $title"
curl -s -o /dev/null \
-X POST \
--data "$(jq --arg body "$MESSAGE" -n '{body: $body}')" \
--header "authorization: Bearer $GITHUB_TOKEN" \
--header 'content-type: application/json' \
"https://api.github.com/repos/AlexRogalskiy/object-mappers-playground/issues/$number/comments"

curl -s -o /dev/null \
-X PATCH \
--data '{"state": "close"}' \
--header "authorization: Bearer $GITHUB_TOKEN" \
--header 'content-type: application/json' \
"https://api.github.com/repos/AlexRogalskiy/object-mappers-playground/pulls/$number"
done < <(curl -H "Content-Type: application/json" \
--header "authorization: Bearer $GITHUB_TOKEN" \
"https://api.github.com/search/issues?q=repo:AlexRogalskiy/object-mappers-playground+type:pr+updated:<$(date -d "-21 days" +%Y-%m-%d)+label:pending+is:open" |
jq -r '.items[] | (.number,.title)')
21 changes: 21 additions & 0 deletions .github/scripts/comment-commands/close.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

#doc: Close pending pull request temporary
# shellcheck disable=SC2124
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
MESSAGE=$(cat $SCRIPT_DIR/../closing-message.txt)

set +x #GITHUB_TOKEN
curl -s -o /dev/null \
-X POST \
--data "$(jq --arg body "$MESSAGE" -n '{body: $body}')" \
--header "authorization: Bearer $GITHUB_TOKEN" \
--header 'content-type: application/json' \
"$(jq -r '.issue.comments_url' "$GITHUB_EVENT_PATH")"

curl -s -o /dev/null \
-X PATCH \
--data '{"state": "close"}' \
--header "authorization: Bearer $GITHUB_TOKEN" \
--header 'content-type: application/json' \
"$(jq -r '.issue.pull_request.url' "$GITHUB_EVENT_PATH")"
7 changes: 7 additions & 0 deletions .github/scripts/comment-commands/debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

#doc: Show current event json to debug problems

echo "\`\`\`"
cat "$GITHUB_EVENT_PATH"
echo "\`\`\`"
13 changes: 13 additions & 0 deletions .github/scripts/comment-commands/help.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

#doc: Show all the available comment commands
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
echo "Available commands:"
DOCTAG="#"
DOCTAG="${DOCTAG}doc"
for command in "$DIR"/*.sh; do
COMMAND_NAME="$(basename "$command" | sed 's/\.sh$//')"
if [ "$COMMAND_NAME" != "debug" ]; then
printf " * /**%s** %s\n" "$COMMAND_NAME" "$(grep $DOCTAG "$command" | sed "s/$DOCTAG//g")"
fi
done
11 changes: 11 additions & 0 deletions .github/scripts/comment-commands/label.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

#doc: add new label to the issue: `/label <label>`
LABEL="$1"
URL="$(jq -r '.issue.url' "$GITHUB_EVENT_PATH")/labels"
set +x #GITHUB_TOKEN
curl -s -o /dev/null \
-X POST \
--data "$(jq --arg value "$LABEL" -n '{labels: [ $value ]}')" \
--header "authorization: Bearer $GITHUB_TOKEN" \
"$URL"
22 changes: 22 additions & 0 deletions .github/scripts/comment-commands/pending.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

#doc: Add a REQUESTED_CHANGE type review to mark issue non-mergeable: `/pending <reason>`
# shellcheck disable=SC2124
MESSAGE="Marking this issue as un-mergeable as requested.
Please use \`/ready\` comment when it's resolved.
Please note that the PR will be closed after 21 days of inactivity from now. (But can be re-opened anytime later...)
> $@"

URL="$(jq -r '.issue.pull_request.url' "$GITHUB_EVENT_PATH")/reviews"
set +x #GITHUB_TOKEN
curl -s -o /dev/null \
--data "$(jq --arg body "$MESSAGE" -n '{event: "REQUEST_CHANGES", body: $body}')" \
--header "authorization: Bearer $GITHUB_TOKEN" \
--header 'content-type: application/json' \
"$URL"

curl -s -o /dev/null \
-X POST \
--data '{"labels": [ "pending" ]}' \
--header "authorization: Bearer $GITHUB_TOKEN" \
"$(jq -r '.issue.url' "$GITHUB_EVENT_PATH")/labels"
20 changes: 20 additions & 0 deletions .github/scripts/comment-commands/ready.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

#doc: Dismiss all the blocking reviews by github-actions bot
MESSAGE="Blocking review request is removed."
URL="$(jq -r '.issue.pull_request.url' "$GITHUB_EVENT_PATH")/reviews"
set +x #GITHUB_TOKEN
curl -s "$URL" |
jq -r '.[] | [.user.login, .id] | @tsv' |
grep github-actions |
awk '{print $2}' |
xargs -n1 -IISSUE_ID curl -s -o /dev/null \
-X PUT \
--data "$(jq --arg message "$MESSAGE" -n '{message: $message}')" \
--header "authorization: Bearer $GITHUB_TOKEN" \
"$URL"/ISSUE_ID/dismissals

curl -s -o /dev/null \
-X DELETE \
--header "authorization: Bearer $GITHUB_TOKEN" \
"$(jq -r '.issue.url' "$GITHUB_EVENT_PATH")/labels/pending"
61 changes: 61 additions & 0 deletions .github/scripts/comment-commands/retest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env bash

#doc: provide help on how to trigger new CI build

# posting a new commit from this script does not trigger CI checks
# https://help.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token

set -eu

code='```'

pr_url="$(jq -r '.issue.pull_request.url' "${GITHUB_EVENT_PATH}")"
commenter="$(jq -r '.comment.user.login' "${GITHUB_EVENT_PATH}")"
assoc="$(jq -r '.comment.author_association' "${GITHUB_EVENT_PATH}")"

curl -LSs "${pr_url}" -o pull.tmp
source_repo="$(jq -r '.head.repo.ssh_url' pull.tmp)"
branch="$(jq -r '.head.ref' pull.tmp)"
pr_owner="$(jq -r '.head.user.login' pull.tmp)"
maintainer_can_modify="$(jq -r '.maintainer_can_modify' pull.tmp)"

# PR owner
# =>
# has local branch, can simply push
if [[ "${commenter}" == "${pr_owner}" ]]; then
cat <<-EOF
To re-run CI checks, please follow these steps with the source branch checked out:
${code}
git commit --allow-empty -m 'trigger new CI check'
git push
${code}
EOF

# member AND modification allowed by PR author
# OR
# repo owner
# =>
# include steps to fetch branch
elif [[ "${maintainer_can_modify}" == "true" ]] && [[ "${assoc}" == "MEMBER" ]] || [[ "${assoc}" == "OWNER" ]]; then
cat <<-EOF
To re-run CI checks, please follow these steps:
${code}
git fetch "${source_repo}" "${branch}"
git checkout FETCH_HEAD
git commit --allow-empty -m 'trigger new CI check'
git push "${source_repo}" HEAD:"${branch}"
${code}
EOF

# other folks
# =>
# ping author
else
cat <<-EOF
@${pr_owner} please trigger new CI check by following these steps:
${code}
git commit --allow-empty -m 'trigger new CI check'
git push
${code}
EOF
fi
41 changes: 41 additions & 0 deletions .github/scripts/process-comment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash

set +x #don't show GITHUB_TOKEN

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
BODY=$(jq -r .comment.body "$GITHUB_EVENT_PATH")
LINES=$(printf "%s" "$BODY" | wc -l)
if [ "$LINES" == "0" ]; then
if [[ "$BODY" == /* ]]; then
echo "Command $BODY is received"
COMMAND=$(echo "$BODY" | awk '{print $1}' | sed 's/\///')
ARGS=$(echo "$BODY" | cut -d ' ' -f2-)
if [ -f "$SCRIPT_DIR/comment-commands/$COMMAND.sh" ]; then
RESPONSE=$("$SCRIPT_DIR/comment-commands/$COMMAND.sh" "${ARGS[@]}")
EXIT_CODE=$?
if [[ $EXIT_CODE != 0 ]]; then
# shellcheck disable=SC2124
RESPONSE="> $BODY
Script execution has been failed with exit code $EXIT_CODE. Please check the output of the github action run to get more information.
\`\`\`
$RESPONSE
\`\`\`
"
fi
else
RESPONSE="No such command. \`$COMMAND\` $("$SCRIPT_DIR/comment-commands/help.sh")"
fi
if [ "$GITHUB_TOKEN" ]; then
set +x #do not display the GITHUB_TOKEN
COMMENTS_URL=$(jq -r .issue.comments_url "$GITHUB_EVENT_PATH")
curl -s \
--data "$(jq --arg body "$RESPONSE" -n '{body: $body}')" \
--header "authorization: Bearer $GITHUB_TOKEN" \
--header 'content-type: application/json' \
"$COMMENTS_URL"
else
echo "$RESPONSE"
fi
fi
fi
13 changes: 13 additions & 0 deletions .github/workflows/add-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Pull Request Labeler

on:
pull_request_target:
types: [ opened ]

jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: ericcornelissen/labeler@label-based-on-status
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
44 changes: 44 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Automerge release bump PR

on:
pull_request_target:
types:
- labeled
- unlabeled
- synchronize
- opened
- edited
- ready_for_review
- reopened
- unlocked
pull_request_review:
types:
- submitted

jobs:

autoapprove:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Autoapproving
uses: hmarr/auto-approve-action@v2
if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]'
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

automerge:
needs: [ autoapprove ]
runs-on: ubuntu-latest
steps:
- name: Automerging
uses: pascalgn/[email protected]
if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]'
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_LOGIN: AlexRogalskiy
MERGE_LABELS: ""
MERGE_METHOD: "squash"
MERGE_COMMIT_MESSAGE: "pull-request-title"
MERGE_RETRIES: "20"
MERGE_RETRY_SLEEP: "20000"
41 changes: 41 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# From: https://github.com/hopsoft/stimulus_reflex/blob/master/.github/workflows/changelog.yml
name: Changelog

on:
workflow_dispatch:
release:
types: [ created ]
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 4
if: "!contains(github.event.head_commit.message, '[nodoc]')"
steps:
- uses: actions/checkout@master
- name: Set up Ruby 3.0
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
- uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-changelog-gem
restore-keys: ${{ runner.os }}-changelog-gem
- name: Create local changes
run: |
gem install github_changelog_generator
github_changelog_generator -u ${{ github.repository_owner }} -p ${{ github.event.repository.name }} --token ${{ secrets.GITHUB_TOKEN }} --exclude-labels duplicate,question,invalid,wontfix,nodoc
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git commit -am "[nodoc] Update Changelog\n\nAdded CHANGELOG file" || echo "No changes to commit"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
21 changes: 21 additions & 0 deletions .github/workflows/close-pending.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: close-prs

on:
schedule:
## https://crontab.guru/examples.html
# Every day
- cron: '0 1 * * *'

jobs:
close-pending:
name: close-pending
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master

- name: Execute close-pending script
if: github.repository == 'AlexRogalskiy/gradle-kotlin-sample'
run: .github/scripts/close-pending.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading