Skip to content

Commit bec6a00

Browse files
authored
Initial scaffolding (#1)
* initial scaffolding * wip (mouse died?) * wip (sketchy mouse) * test memo import * basic code to add a runrequest based on slx tag * swap to import platform variable * wip. rr updates with task titles. pagerduty task. update layout * refactor to patch runsession instead of posting a runrequest * update memo import * test updated keyword * add var test * update * x * x * shift platform variable fetching to keywords, ensure runrequest id is used when fetching memo json * fix filter for pagerduty * improve pagerduty so that it can post back to an incident (if the API token exists) --------- Co-authored-by: stewartshea <>
1 parent 23bb0dc commit bec6a00

29 files changed

+1910
-2
lines changed

.devcontainer.json

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"name": "devtools",
3+
"shutdownAction": "none",
4+
"build": { "dockerfile": "Dockerfile" },
5+
"updateRemoteUserUID": false,
6+
// "remoteUser": "python",
7+
"overrideCommand": false,
8+
"runArgs": [
9+
"-p",
10+
"3000:3000",
11+
"--name",
12+
"mycodecollection"
13+
],
14+
"forwardPorts": [
15+
3000
16+
],
17+
"workspaceFolder": "/app/",
18+
// Configure tool-specific properties.
19+
"customizations": {
20+
// Configure properties specific to VS Code.
21+
// configuration following google standard
22+
"vscode": {
23+
"extensions": [
24+
"robocorp.robotframework-lsp",
25+
"ms-python.pylint",
26+
"ms-python.black-formatter",
27+
"ms-python.python",
28+
"njpwerner.autodocstring"
29+
],
30+
"settings": {
31+
"python.languageServer": "Jedi",
32+
"python.linting.enabled": true,
33+
"python.linting.pylintEnabled": true,
34+
"python.linting.pylintArgs": [
35+
"--max-line-length=120",
36+
"--enable=W0614" // track unused imports
37+
],
38+
"[python]": {
39+
"editor.insertSpaces": true,
40+
"editor.tabSize": 4
41+
},
42+
"editor.formatOnSave": true,
43+
"editor.lineNumbers": "on",
44+
"python.formatting.provider": "black",
45+
"python.formatting.blackArgs": [
46+
"--line-length",
47+
"120"
48+
],
49+
"robot.language-server.python": "/usr/local/bin/python",
50+
"robot.pythonpath": [
51+
"/app",
52+
"/app/rw-public-codecollection/libraries",
53+
"/app/rw-public-codecollection/libraries/RW",
54+
"/app/codecollection/libraries",
55+
"/app/codecollection/libraries/RW",
56+
"/app/dev_facade"
57+
]
58+
}
59+
}
60+
}
61+
}

.github/CODEOWNERS

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This is a comment.
2+
# Each line is a file pattern followed by one or more owners.
3+
# Read more: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
4+
5+
# These owners will be the default owners for everything in
6+
# the repo. Unless a later match takes precedence,
7+
# these owners will be requested for
8+
# review when someone opens a pull request.
9+
* @runwhen-contrib/runwhen-team
10+
11+
# Order is important; the last matching pattern takes the most
12+
# precedence.
13+
14+
# When someone opens a pull request that only
15+
# modifies JS files, only @js-owner and not the global
16+
# owner(s) will be requested for a review.

.github/config.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#####
2+
# Configuration for sentiment-bot - https://github.com/behaviorbot/sentiment-bot
3+
# *Required* toxicity threshold between 0 and .99 with the higher numbers being the most toxic
4+
# Anything higher than this threshold will be marked as toxic and commented on
5+
sentimentBotToxicityThreshold: .8
6+
# *Required* Comment to reply with
7+
sentimentBotReplyComment: >
8+
Please be sure to review the code of conduct and be respectful of other users. cc/ @jon-funk
9+
# Note: the bot will only work if your repository has a Code of Conduct
10+
11+
#####
12+
# Configuration for welcome - https://github.com/behaviorbot/welcome
13+
# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome
14+
# Comment to be posted to on first time issues
15+
newIssueWelcomeComment: >
16+
Welcome and thank you for your interest in the community! A RunWhen team member will be by to review this issue shortly!
17+
# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome
18+
# Comment to be posted to on PRs from first time contributors in your repository
19+
newPRWelcomeComment: >
20+
Thank you! A RunWhen team member will be by to review this PR shortly!
21+
# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge
22+
# Comment to be posted to on pull requests merged by a first time user
23+
firstPRMergeComment: >
24+
Woohoo! Congrats on merging your first contribution!

.github/scripts/index-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# in the repos, the key specifies the name of the temp directory name
2+
repos:
3+
rw-workspace-utils: https://github.com/runwhen-contrib/rw-workspace-utils.git
4+
robot_file_pattern:
5+
codebundles: .robot

.github/scripts/semver-it.sh

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/bin/bash
2+
# ======================================================================================
3+
# Synopsis: script for managing the semver tags in a repo by referencing a file's contents.
4+
# If a changelog filename is provided then it will be written to.
5+
6+
function semver_it_help (){
7+
echo "
8+
semver-it help
9+
10+
Usage: ./semver-it.sh <path_to_version_file> <path_to_changelog_file>
11+
12+
Examples:
13+
semantic version for newest version and generate a new changelog entry containing all git log lines with 'Feat' or 'Add' since the previous tag
14+
./semver-it.sh ../../VERSION ../../CHANGELOG '(Feat|Add)'
15+
"
16+
}
17+
18+
function main (){
19+
if [ $1 == "help" ]; then
20+
semver_it_help
21+
exit 0
22+
fi
23+
skip_changelog=0
24+
temp_file_path="/tmp/temp_changelog"
25+
if [ -z "$1" ]; then
26+
echo "Error: no version filename provided"
27+
exit 1
28+
fi
29+
if [ -z "$2" ]; then
30+
echo "Changelog filepath not provided - configured to not create changelog entry"
31+
skip_changelog=1
32+
fi
33+
if [ -z "$3" ]; then
34+
changelog_pattern="Add"
35+
else
36+
changelog_pattern=$3
37+
fi
38+
echo "changelog entry pattern set to: $changelog_pattern"
39+
version_filename=$1
40+
changelog_filename=$2
41+
new_version="$(cat $version_filename)"
42+
new_tag="v$new_version"
43+
# get the last tag value from a diff on the version file
44+
# we pull from the file so that we're not affected by devs pushing patch tags in between
45+
previous_version=$(git log -p -1 $version_filename | grep ^- | tail -n 1 | sed 's/\-//')
46+
previous_tag="v$previous_version"
47+
current_date=$(date +%Y-%m-%d)
48+
if [ -z "$previous_tag" ]; then
49+
echo "No previous tag found - skipping changelog generation"
50+
skip_changelog=1
51+
fi
52+
# TODO: add new_semver > last_semver check
53+
# TODO: handle edge case when tag is subset of another tag, eg: 1.0.1 =/= 1.0.10
54+
# tag_in_changelog=$(grep "$new_tag" $changelog_filename)
55+
# if [ -n "$tag_in_changelog" ]; then
56+
# echo "Tag already in changelog - skipping"
57+
# skip_changelog=1
58+
# fi
59+
if [ "$skip_changelog" -eq 0 ]; then
60+
last_tag_hash=$(git rev-list -n 1 "$previous_tag")
61+
if [ -z $last_tag_hash ]; then
62+
echo "Could not find a last tag hash with: git rev-list -n 1 "$previous_tag""
63+
exit 1
64+
else
65+
echo "found last tag hash: $last_tag_hash"
66+
fi
67+
# we format in the - for markdown
68+
commit_message_aggregate="$(git log --pretty=format:"- %s %h" --no-merges "${last_tag_hash}..HEAD" | grep -E "$changelog_pattern")"
69+
changelog_entry="## ${new_version} ${current_date}$(echo -e "\n${commit_message_aggregate}\n")"
70+
echo "changelog entry:"
71+
echo -e "${changelog_entry}"
72+
echo -e "${changelog_entry}\n" | cat - $changelog_filename > $temp_file_path && mv $temp_file_path $changelog_filename
73+
fi
74+
echo ""
75+
echo "Date: $current_date"
76+
echo "New tag: $new_tag"
77+
echo "Previous tag: $previous_tag"
78+
79+
if [ "$skip_changelog" -eq 0 ]; then
80+
echo "A changelog entry was added, you may now commit the change and version control it"
81+
fi
82+
83+
echo "Creating git tag $new_tag, you may now push it to remote"
84+
git tag $new_tag
85+
return $?
86+
}
87+
main "$@"

.github/workflows/semver.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Semantic Versioning
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "VERSION"
9+
10+
jobs:
11+
semver-it:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
17+
ref: ${{ github.event.pull_request.base.ref }}
18+
- name: Fetch All Tags
19+
run: |
20+
git fetch --tags origin
21+
# show all known tags
22+
git tag
23+
- name: Create Semver Tag and Changelog Entry
24+
run: |
25+
git config --global user.email "${GITHUB_ACTOR}"
26+
git config --global user.name "${GITHUB_ACTOR}@users.noreply.github.com"
27+
git checkout -b "automatic-changelog-update"
28+
29+
# Run the semver-it script
30+
./.github/scripts/semver-it.sh VERSION CHANGELOG.md '(Feat|Add)'
31+
if [ $? -eq 0 ]; then
32+
most_recent_tag=$(git describe --tags --abbrev=0)
33+
echo "Found most recent tag from semver it as $most_recent_tag"
34+
echo "Pushing tag: $most_recent_tag"
35+
git push origin "$most_recent_tag"
36+
else
37+
echo "return code of semver-it is $?"
38+
exit 1
39+
fi
40+
41+
git add CHANGELOG.md
42+
# Test if any git changes are made. If not, bail out and send instruction.
43+
if [ -z "$(git diff-index HEAD)" ]; then
44+
echo "No git changes detected to add to the changelog"
45+
exit 0
46+
else
47+
echo "Changes detected in changelog. Pushing..."
48+
git commit -m "Updating changelog"
49+
git push --set-upstream origin automatic-changelog-update
50+
fi
51+
52+
# Open up a PR
53+
PR_OUTPUT=$(curl -X POST -H "Authorization: Token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" -d '{"title":"automatic-changelog-update","head":"automatic-changelog-update","base":"main","body":"automatic-changelog-update" }' https://api.github.com/repos/${{ github.event.repository.owner.login }}/${{ github.event.repository.name }}/pulls)
54+
PR_LINK=$(echo $PR_OUTPUT| jq '._links.html.href' )
55+
PR_LINK=$(echo $PR_LINK | tr -d '"')
56+
# attempt auto merge but accept fail
57+
# disabling for now
58+
# gh pr merge --auto --squash $PR_LINK || 0
59+
env:
60+
GH_TOKEN: ${{ github.token }}

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*codecollection.yaml
2+
__pycache__
3+
output.xml
4+
log.html
5+
report.html
6+
dist
7+
build
8+
*egg-info
9+
.kube
10+
*.out
11+
12+
13+
14+
15+

.gitpod.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This configuration file was automatically generated by Gitpod.
2+
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
3+
# and commit this file to your remote git repository to share the goodness with others.
4+
5+
# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart
6+
7+
tasks:
8+
- init: pip install -r requirements.txt

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

CONTRIBUTING.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<!-- omit in toc -->
2+
3+
# Contributing to Runwhen Public CodeCollection
4+
5+
First off, thanks for taking the time to contribute! ❤️
6+
7+
All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. We look forward to your contributions. 🎉
8+
9+
<!-- omit in toc -->
10+
11+
## Table of Contents
12+
13+
- [Code of Conduct](#code-of-conduct)
14+
- [I Have a Question](#i-have-a-question)
15+
- [I Want To Contribute](#i-want-to-contribute)
16+
- [Reporting Bugs](#reporting-bugs)
17+
- [Suggesting Enhancements](#suggesting-enhancements)
18+
- [Your First Code Contribution](#your-first-code-contribution)
19+
- [Improving The Documentation](#improving-the-documentation)
20+
- [Styleguides](#styleguides)
21+
- [Commit Messages](#commit-messages)
22+
- [Join The Project Team](#join-the-project-team)
23+
24+
## Code of Conduct
25+
26+
This project and everyone participating in it is governed by the
27+
[Runwhen Public CodeCollection Code of Conduct](https://github.com/runwhen-contrib/rw-workspace-utilsblob/master/CODE_OF_CONDUCT.md).
28+
By participating, you are expected to uphold this code. Please report unacceptable behavior
29+
30+
31+
## I Have a Question
32+
33+
> If you want to ask a question, we assume that you have read the available [Documentation](https://docs.runwhen.com/public/).
34+
35+
Before you ask a question, it is best to search for existing [Issues](https://github.com/runwhen-contrib/rw-workspace-utils/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first.
36+
37+
If you then still feel the need to ask a question and need clarification, we recommend the following:
38+
39+
- Open an [Issue](https://github.com/runwhen-contrib/rw-workspace-utils/issues/new).
40+
- Provide as much context as you can about what you're running into.
41+
- Provide project and platform versions (Python, RobotFramework), depending on what seems relevant.
42+
43+
We will then take care of the issue as soon as possible.
44+
45+
## I Want To Contribute
46+
47+
> ### Legal Notice <!-- omit in toc -->
48+
>
49+
> When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license.
50+
51+
### Reporting Bugs
52+
53+
<!-- omit in toc -->
54+
55+
#### How Do I Submit a Good Bug Report?
56+
57+
> You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to <[email protected]>.
58+
59+
We use GitHub issues to track bugs and errors. If you run into an issue with the project:
60+
61+
- Open an [Issue](https://github.com/runwhen-contrib/rw-workspace-utils/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.)
62+
- Explain the behavior you would expect and the actual behavior.
63+
- Please provide as much context as possible and describe the _reproduction steps_ that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case.
64+
- Provide the information you collected in the previous section.
65+
66+
Once it's filed:
67+
68+
- The project team will label the issue accordingly.
69+
- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced.
70+
- If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be [implemented by someone](#your-first-code-contribution).
71+
72+
### Suggesting Enhancements
73+
74+
This section guides you through submitting an enhancement suggestion for Runwhen Public CodeCollection, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions.
75+
76+
<!-- omit in toc -->
77+
78+
#### Before Submitting an Enhancement
79+
80+
- Make sure that you are using the latest version.
81+
- Read the [documentation](https://docs.runwhen.com/public/) carefully and find out if the functionality is already covered, maybe by an individual configuration.
82+
- Perform a [search](https://github.com/runwhen-contrib/rw-workspace-utils/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.
83+
- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library.
84+
85+
<!-- omit in toc -->
86+
87+
#### How Do I Submit a Good Enhancement Suggestion?
88+
89+
Enhancement suggestions are tracked as [GitHub issues](https://github.com/runwhen-contrib/rw-workspace-utils/issues).
90+
91+
- Use a **clear and descriptive title** for the issue to identify the suggestion.
92+
- Provide a **step-by-step description of the suggested enhancement** in as many details as possible.
93+
- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you.
94+
- You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux.
95+
- **Explain why this enhancement would be useful** to most Runwhen Public CodeCollection users. You may also want to point out the other projects that solved it better and which could serve as inspiration.
96+
97+
## Attribution
98+
99+
This guide is based on the **contributing-gen**. [Make your own](https://github.com/bttger/contributing-gen)!

0 commit comments

Comments
 (0)