Skip to content

Commit eae6cde

Browse files
Initial commit
0 parents  commit eae6cde

File tree

7 files changed

+424
-0
lines changed

7 files changed

+424
-0
lines changed

.circleci/config.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
orbs:
2+
tutorial-checker-orb: saptutorials/[email protected]
3+
version: 2.1
4+
notify:
5+
webhooks:
6+
- url: https://webhooks.gitter.im/e/15f197634234d80a32fa
7+
workflows:
8+
version: 2
9+
nightly:
10+
triggers:
11+
- schedule:
12+
cron: "0 0 * * 0-5"
13+
filters:
14+
branches:
15+
only:
16+
- main
17+
jobs:
18+
- tutorial-checker-orb/build-all
19+
build:
20+
jobs:
21+
- tutorial-checker-orb/build-pull-request
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: SAP Community profile URL requester
2+
3+
# What the execution context is:
4+
# The assignment of a label to an issue or pull request indicating
5+
# that the contribution was valuable.
6+
7+
# What it does:
8+
# Adds a comment to the issue or pull request asking the author for
9+
# their SAP Community profile URL ('community ID').
10+
11+
# Why we need it:
12+
# So that we can properly recognize the contribution in SAP Community.
13+
14+
# What's important to know:
15+
# The label is specified at the start of the 'community-id-requester'
16+
# job as an environment variable LABEL, and also in the job-level condition.
17+
# Also, it adds a comment only after the first time the label is added, and
18+
# only if there are no other issues / pull requests already labeled.
19+
20+
on:
21+
pull_request_target:
22+
types: [labeled]
23+
issues:
24+
types: [labeled]
25+
26+
jobs:
27+
28+
community-id-requester:
29+
30+
env:
31+
LABEL: "contribution"
32+
runs-on: ubuntu-20.04
33+
if: contains(github.repositoryUrl, 'github.com') && github.event.label.name == 'contribution'
34+
35+
steps:
36+
37+
- id: token_gen
38+
name: Generate app installation token
39+
uses: machine-learning-apps/[email protected]
40+
with:
41+
APP_PEM: ${{ secrets.SAP_TUTORIALS_APP_PEM_BASE64 }}
42+
APP_ID: ${{ secrets.SAP_TUTORIALS_APP_ID }}
43+
44+
- id: checkout
45+
name: Check out the repo
46+
uses: actions/checkout@v2
47+
with:
48+
token: ${{ steps.token_gen.outputs.app_token }}
49+
50+
- id: issue_details
51+
name: Determine related details if issue
52+
if: github.event_name == 'issues'
53+
run: |
54+
echo "OBJECTTYPE=issue" >> $GITHUB_ENV
55+
echo "CONTRIBUTIONTYPE=feedback" >> $GITHUB_ENV
56+
echo "OBJECTNR=${{ github.event.issue.number }}" >> $GITHUB_ENV
57+
echo "CONTRIBUTOR=${{ github.event.issue.user.login }}" >> $GITHUB_ENV
58+
- id: pull_request_details
59+
name: Determine related details if pull request
60+
if: github.event_name == 'pull_request_target'
61+
run: |
62+
echo "OBJECTTYPE=pr" >> $GITHUB_ENV
63+
echo "CONTRIBUTIONTYPE=content" >> $GITHUB_ENV
64+
echo "OBJECTNR=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
65+
echo "CONTRIBUTOR=${{ github.event.pull_request.user.login }}" >> $GITHUB_ENV
66+
- id: auth_gh
67+
name: Authenticate gh to repo
68+
run: echo -n ${{ steps.token_gen.outputs.app_token }} | gh auth login --with-token
69+
70+
- id: count_label_additions
71+
name: Count number of times label has been added
72+
run: |
73+
endpoint="repos/${{ github.repository }}/issues/$OBJECTNR/events"
74+
count=$(gh api --jq "[.[]|(select(.event==\"labeled\" and .label.name==\"$LABEL\"))] | length" $endpoint)
75+
echo "LABELADDITIONCOUNT=$count" >> $GITHUB_ENV
76+
- id: count_previous_labeled_objects
77+
name: Count how many other issues / pull requests are so labeled
78+
run: |
79+
querystring="is:${OBJECTTYPE}+label:${LABEL}+author:${CONTRIBUTOR}+repo:${GITHUB_REPOSITORY}"
80+
result=$(gh api --jq '.items[] | [.number, .title] | @tsv' "/search/issues?q=$querystring")
81+
echo "$result"
82+
echo "OBJECTCOUNT=$(wc -l <<< $result)" | tee -a $GITHUB_ENV
83+
- id: requester
84+
name: Ask for SAP Community profile URL if label added for first time and no prev labeled issue / pr
85+
if: env.LABELADDITIONCOUNT == 1 && env.OBJECTCOUNT <= 1
86+
run: |
87+
printf "Thank you for your valuable ${CONTRIBUTIONTYPE} contribution, @${CONTRIBUTOR}! So that we can [recognize your contribution in SAP Community](https://github.com/SAP-docs/contribution-guidelines/blob/main/docs/recognition.md), please tell us your SAP Community profile URL in a reply to this comment; don't include any other text, just the URL on its own, like this:\n\n\`\`\`\nhttps://people.sap.com/your-user-name\n\`\`\`\n\nThanks!" \
88+
| gh $OBJECTTYPE comment $OBJECTNR --body-file -

.github/workflows/label-issues.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Task Issue Labeler
2+
on:
3+
issues:
4+
types:
5+
- opened
6+
jobs:
7+
Label-New-Issues:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: SAP task issue labeler
11+
uses: sap-tutorials/tutorial-actions@main
12+
with:
13+
token: ${{ secrets.GITHUB_TOKEN }}
14+
15+
16+
17+
18+
19+
20+

.gitignore

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
node_modules
2+
.config
3+
.idea
4+
analyze/reports/report_*.csv
5+
6+
# Compiled source #
7+
###################
8+
*.com
9+
*.class
10+
*.dll
11+
*.exe
12+
*.o
13+
*.so
14+
15+
# Packages #
16+
############
17+
# it's better to unpack these files and commit the raw source
18+
# git has its own built in compression methods
19+
*.7z
20+
*.dmg
21+
*.gz
22+
*.jar
23+
*.zip
24+
25+
# Logs and databases #
26+
######################
27+
*.log
28+
*.sqlite
29+
30+
# Backup files #
31+
######################
32+
*.bak
33+
34+
# OS generated files #
35+
######################
36+
.DS_Store
37+
.DS_Store?
38+
._*
39+
.Spotlight-V100
40+
.Trashes
41+
ehthumbs.db
42+
Thumbs.db
43+
44+
.DS_Store
45+
46+
# validation files #
47+
######################
48+
rules.vr

0 commit comments

Comments
 (0)