Skip to content

Commit

Permalink
Merge pull request #1 from casperdcl/devel
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl authored Sep 17, 2021
2 parents 7003632 + 00bf2e2 commit 884b166
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: casperdcl
custom: https://cdcl.ml/sponsor
52 changes: 52 additions & 0 deletions .github/workflows/comment-bot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Comment Bot
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
tag: # /tag <tagname> <commit>
if: startsWith(github.event.comment.body, '/tag ')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: React Seen
uses: actions/github-script@v2
with:
script: |
const perm = await github.repos.getCollaboratorPermissionLevel({
owner: context.repo.owner, repo: context.repo.repo,
username: context.payload.comment.user.login})
post = (context.eventName == "issue_comment"
? github.reactions.createForIssueComment
: github.reactions.createForPullRequestReviewComment)
if (!["admin", "write"].includes(perm.data.permission)){
post({
owner: context.repo.owner, repo: context.repo.repo,
comment_id: context.payload.comment.id, content: "laugh"})
throw "Permission denied for user " + context.payload.comment.user.login
}
post({
owner: context.repo.owner, repo: context.repo.repo,
comment_id: context.payload.comment.id, content: "eyes"})
github-token: ${{ secrets.GH_TOKEN }}
- name: Tag Commit
run: |
git clone https://${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} repo
git -C repo tag $(echo "$BODY" | awk '{print $2" "$3}')
git -C repo push --tags
rm -rf repo
env:
BODY: ${{ github.event.comment.body }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: React Success
uses: actions/github-script@v2
with:
script: |
post = (context.eventName == "issue_comment"
? github.reactions.createForIssueComment
: github.reactions.createForPullRequestReviewComment)
post({
owner: context.repo.owner, repo: context.repo.repo,
comment_id: context.payload.comment.id, content: "rocket"})
github-token: ${{ secrets.GH_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
- cron: '6 0 * * *' # M H d m w (daily at 00:06)
jobs:
ghstat:
if: github.event_name != 'pull_request' || github.repository_owner != 'casperdcl'
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v2
Expand All @@ -19,6 +20,7 @@ jobs:
repos-skip: ${{ secrets.REPOS_SKIP }}
lang-names: ${{ secrets.LANG_NAMES }}
check:
if: github.event_name != 'pull_request' || github.repository_owner != 'casperdcl'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion LICENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ Exhibit A - Source Code Form License Notice

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
project, You can obtain one at http://mozilla.org/MPL/2.0/.

If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
Expand Down
28 changes: 14 additions & 14 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ inputs:
runs:
using: composite
steps:
- name: setup
run: pip install -r ${{ github.action_path }}/requirements.txt
shell: bash
- name: ghstat
run: ${{ github.action_path }}/ghstat.sh
shell: bash
env:
GH_TOKEN: ${{ inputs.github-token }}
GH_GIST_ID: ${{ inputs.gist-id }}
AUTHOR: ${{ inputs.author }}
GH_USER: ${{ inputs.user }}
REPOS_INCL: ${{ inputs.repos-incl }}
REPOS_SKIP: ${{ inputs.repos-skip }}
LANG_NAMES: ${{ inputs.lang-names }}
- name: setup
run: pip install -r ${{ github.action_path }}/requirements.txt
shell: bash
- name: ghstat
run: ${{ github.action_path }}/ghstat.sh
shell: bash
env:
GH_TOKEN: ${{ inputs.github-token }}
GH_GIST_ID: ${{ inputs.gist-id }}
AUTHOR: ${{ inputs.author }}
GH_USER: ${{ inputs.user }}
REPOS_INCL: ${{ inputs.repos-incl }}
REPOS_SKIP: ${{ inputs.repos-skip }}
LANG_NAMES: ${{ inputs.lang-names }}
branding:
icon: pie-chart
color: purple
2 changes: 1 addition & 1 deletion ghstat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ if [[ -n "$GH_USER" ]]; then
)"
repos="$(echo "$repos" | sort -u | comm -23 - <(for i in $REPOS_INCL; do echo $i; done | sort -u))"
repos="$(echo "$repos" | sort -u | comm -23 - <(for i in $REPOS_SKIP; do echo $i; done | sort -u))"
total="$(echo $repos | wc -w)"
total="$(echo "$repos" | wc -w)"
REPOS_INCL="$REPOS_INCL $(
i=0
for repo in $repos; do
Expand Down

0 comments on commit 884b166

Please sign in to comment.