Skip to content

Commit ace3a59

Browse files
Added checks and updated the help comment for PRs
1 parent f69b789 commit ace3a59

2 files changed

Lines changed: 66 additions & 1 deletion

File tree

.github/workflows/checkpr.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Check PR
2+
3+
on:
4+
pull_request_target:
5+
types: [opened]
6+
7+
jobs:
8+
check:
9+
runs-on: ubuntu-latest
10+
env:
11+
PR_NUMBER: ${{github.event.number}}
12+
13+
steps:
14+
- name: Get PR info
15+
id: pr_info
16+
run: |
17+
content=`curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}`
18+
# the following lines are only required for multi line json
19+
content="${content//'%'/'%25'}"
20+
content="${content//$'\n'/'%0A'}"
21+
content="${content//$'\r'/'%0D'}"
22+
# end of optional handling for multi line json
23+
echo "::set-output name=json::$content"
24+
25+
- name: Check draft
26+
if: "${{!startsWith(fromJson(steps.pr_info.outputs.json).title,'WIP') && !fromJson(steps.pr_info.outputs.json).draft}}"
27+
uses: mshick/add-pr-comment@v1
28+
with:
29+
repo-token: ${{ secrets.GITHUB_TOKEN }}
30+
repo-token-user-login: 'github-actions[bot]'
31+
message: |
32+
Please mark your pull request as draft until it is finished: https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/changing-the-stage-of-a-pull-request#converting-a-pull-request-to-a-draft
33+
34+
- name: Check title
35+
if: "${{contains(fromJson(steps.pr_info.outputs.json).title, 'commit')}}"
36+
uses: mshick/add-pr-comment@v1
37+
with:
38+
repo-token: ${{ secrets.GITHUB_TOKEN }}
39+
repo-token-user-login: 'github-actions[bot]'
40+
message: |
41+
Please add a meaningful title to your pull request.
42+
43+
- name: Check body
44+
if: "${{fromJson(steps.pr_info.outputs.json).body == null}}"
45+
uses: mshick/add-pr-comment@v1
46+
with:
47+
repo-token: ${{ secrets.GITHUB_TOKEN }}
48+
repo-token-user-login: 'github-actions[bot]'
49+
message: |
50+
Please add a description to your pull request.

.github/workflows/pr.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,22 @@ jobs:
1515
repo-token: ${{ secrets.GITHUB_TOKEN }}
1616
repo-token-user-login: 'github-actions[bot]'
1717
message: |
18-
You can view the generated tutorials of this PR on https://www.katacoda.com/devonfw-dev in a few minutes. You just have to wait for the next run of the deployment action https://github.com/devonfw-tutorials/katacoda-scenarios-dev/actions
18+
Thanks for submitting your work on a (new) tutorial!
19+
20+
Some suggestions, which might help:
21+
22+
- Title: Focus on what you want to train in a few words. Don't be too generic
23+
- Tutorial:
24+
- Address the user directly.
25+
- Explain why the steps are necessary.
26+
- Explain what are the results and why are they necessary for your next step.
27+
- Forward the user to more elaborate documentation on the website (deep links) for further reading
28+
29+
Also please find further help for creating tutorials [here](https://www.katacoda.com/devonfw/scenarios/create-your-own-tutorial) or more help regarding the tutorial syntax [here](https://github.com/devonfw-tutorials/tutorials/wiki/Development).
30+
31+
You can view the generated tutorials of this PR [here](https://www.katacoda.com/devonfw-dev) in a few minutes. You just have to wait for the run of the [deployment action](https://github.com/devonfw-tutorials/katacoda-scenarios-dev/actions) to finish.
32+
33+
When you think you are done writing the tutorial try the tutorial on the [deveplopment area](https://www.katacoda.com/devonfw-dev) and check if you explained every step in a way someone who is trying to learn what you are teaching can understand. Ideally ask someone to have a look on what you have done and have that part double checked because this is very important.
1934
2035
- name: Repository dispatch
2136
uses: peter-evans/repository-dispatch@v1

0 commit comments

Comments
 (0)