Skip to content

Commit

Permalink
Initial scaffolding (#1)
Browse files Browse the repository at this point in the history
* 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 <>
  • Loading branch information
stewartshea authored Aug 12, 2024
1 parent 23bb0dc commit bec6a00
Show file tree
Hide file tree
Showing 29 changed files with 1,910 additions and 2 deletions.
61 changes: 61 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"name": "devtools",
"shutdownAction": "none",
"build": { "dockerfile": "Dockerfile" },
"updateRemoteUserUID": false,
// "remoteUser": "python",
"overrideCommand": false,
"runArgs": [
"-p",
"3000:3000",
"--name",
"mycodecollection"
],
"forwardPorts": [
3000
],
"workspaceFolder": "/app/",
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
// configuration following google standard
"vscode": {
"extensions": [
"robocorp.robotframework-lsp",
"ms-python.pylint",
"ms-python.black-formatter",
"ms-python.python",
"njpwerner.autodocstring"
],
"settings": {
"python.languageServer": "Jedi",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.pylintArgs": [
"--max-line-length=120",
"--enable=W0614" // track unused imports
],
"[python]": {
"editor.insertSpaces": true,
"editor.tabSize": 4
},
"editor.formatOnSave": true,
"editor.lineNumbers": "on",
"python.formatting.provider": "black",
"python.formatting.blackArgs": [
"--line-length",
"120"
],
"robot.language-server.python": "/usr/local/bin/python",
"robot.pythonpath": [
"/app",
"/app/rw-public-codecollection/libraries",
"/app/rw-public-codecollection/libraries/RW",
"/app/codecollection/libraries",
"/app/codecollection/libraries/RW",
"/app/dev_facade"
]
}
}
}
}
16 changes: 16 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This is a comment.
# Each line is a file pattern followed by one or more owners.
# Read more: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# these owners will be requested for
# review when someone opens a pull request.
* @runwhen-contrib/runwhen-team

# Order is important; the last matching pattern takes the most
# precedence.

# When someone opens a pull request that only
# modifies JS files, only @js-owner and not the global
# owner(s) will be requested for a review.
24 changes: 24 additions & 0 deletions .github/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#####
# Configuration for sentiment-bot - https://github.com/behaviorbot/sentiment-bot
# *Required* toxicity threshold between 0 and .99 with the higher numbers being the most toxic
# Anything higher than this threshold will be marked as toxic and commented on
sentimentBotToxicityThreshold: .8
# *Required* Comment to reply with
sentimentBotReplyComment: >
Please be sure to review the code of conduct and be respectful of other users. cc/ @jon-funk
# Note: the bot will only work if your repository has a Code of Conduct

#####
# Configuration for welcome - https://github.com/behaviorbot/welcome
# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome
# Comment to be posted to on first time issues
newIssueWelcomeComment: >
Welcome and thank you for your interest in the community! A RunWhen team member will be by to review this issue shortly!
# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome
# Comment to be posted to on PRs from first time contributors in your repository
newPRWelcomeComment: >
Thank you! A RunWhen team member will be by to review this PR shortly!
# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge
# Comment to be posted to on pull requests merged by a first time user
firstPRMergeComment: >
Woohoo! Congrats on merging your first contribution!
5 changes: 5 additions & 0 deletions .github/scripts/index-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# in the repos, the key specifies the name of the temp directory name
repos:
rw-workspace-utils: https://github.com/runwhen-contrib/rw-workspace-utils.git
robot_file_pattern:
codebundles: .robot
87 changes: 87 additions & 0 deletions .github/scripts/semver-it.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/bash
# ======================================================================================
# Synopsis: script for managing the semver tags in a repo by referencing a file's contents.
# If a changelog filename is provided then it will be written to.

function semver_it_help (){
echo "
semver-it help
Usage: ./semver-it.sh <path_to_version_file> <path_to_changelog_file>
Examples:
semantic version for newest version and generate a new changelog entry containing all git log lines with 'Feat' or 'Add' since the previous tag
./semver-it.sh ../../VERSION ../../CHANGELOG '(Feat|Add)'
"
}

function main (){
if [ $1 == "help" ]; then
semver_it_help
exit 0
fi
skip_changelog=0
temp_file_path="/tmp/temp_changelog"
if [ -z "$1" ]; then
echo "Error: no version filename provided"
exit 1
fi
if [ -z "$2" ]; then
echo "Changelog filepath not provided - configured to not create changelog entry"
skip_changelog=1
fi
if [ -z "$3" ]; then
changelog_pattern="Add"
else
changelog_pattern=$3
fi
echo "changelog entry pattern set to: $changelog_pattern"
version_filename=$1
changelog_filename=$2
new_version="$(cat $version_filename)"
new_tag="v$new_version"
# get the last tag value from a diff on the version file
# we pull from the file so that we're not affected by devs pushing patch tags in between
previous_version=$(git log -p -1 $version_filename | grep ^- | tail -n 1 | sed 's/\-//')
previous_tag="v$previous_version"
current_date=$(date +%Y-%m-%d)
if [ -z "$previous_tag" ]; then
echo "No previous tag found - skipping changelog generation"
skip_changelog=1
fi
# TODO: add new_semver > last_semver check
# TODO: handle edge case when tag is subset of another tag, eg: 1.0.1 =/= 1.0.10
# tag_in_changelog=$(grep "$new_tag" $changelog_filename)
# if [ -n "$tag_in_changelog" ]; then
# echo "Tag already in changelog - skipping"
# skip_changelog=1
# fi
if [ "$skip_changelog" -eq 0 ]; then
last_tag_hash=$(git rev-list -n 1 "$previous_tag")
if [ -z $last_tag_hash ]; then
echo "Could not find a last tag hash with: git rev-list -n 1 "$previous_tag""
exit 1
else
echo "found last tag hash: $last_tag_hash"
fi
# we format in the - for markdown
commit_message_aggregate="$(git log --pretty=format:"- %s %h" --no-merges "${last_tag_hash}..HEAD" | grep -E "$changelog_pattern")"
changelog_entry="## ${new_version} ${current_date}$(echo -e "\n${commit_message_aggregate}\n")"
echo "changelog entry:"
echo -e "${changelog_entry}"
echo -e "${changelog_entry}\n" | cat - $changelog_filename > $temp_file_path && mv $temp_file_path $changelog_filename
fi
echo ""
echo "Date: $current_date"
echo "New tag: $new_tag"
echo "Previous tag: $previous_tag"

if [ "$skip_changelog" -eq 0 ]; then
echo "A changelog entry was added, you may now commit the change and version control it"
fi

echo "Creating git tag $new_tag, you may now push it to remote"
git tag $new_tag
return $?
}
main "$@"
60 changes: 60 additions & 0 deletions .github/workflows/semver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Semantic Versioning
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "VERSION"

jobs:
semver-it:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.base.ref }}
- name: Fetch All Tags
run: |
git fetch --tags origin
# show all known tags
git tag
- name: Create Semver Tag and Changelog Entry
run: |
git config --global user.email "${GITHUB_ACTOR}"
git config --global user.name "${GITHUB_ACTOR}@users.noreply.github.com"
git checkout -b "automatic-changelog-update"
# Run the semver-it script
./.github/scripts/semver-it.sh VERSION CHANGELOG.md '(Feat|Add)'
if [ $? -eq 0 ]; then
most_recent_tag=$(git describe --tags --abbrev=0)
echo "Found most recent tag from semver it as $most_recent_tag"
echo "Pushing tag: $most_recent_tag"
git push origin "$most_recent_tag"
else
echo "return code of semver-it is $?"
exit 1
fi
git add CHANGELOG.md
# Test if any git changes are made. If not, bail out and send instruction.
if [ -z "$(git diff-index HEAD)" ]; then
echo "No git changes detected to add to the changelog"
exit 0
else
echo "Changes detected in changelog. Pushing..."
git commit -m "Updating changelog"
git push --set-upstream origin automatic-changelog-update
fi
# Open up a PR
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)
PR_LINK=$(echo $PR_OUTPUT| jq '._links.html.href' )
PR_LINK=$(echo $PR_LINK | tr -d '"')
# attempt auto merge but accept fail
# disabling for now
# gh pr merge --auto --squash $PR_LINK || 0
env:
GH_TOKEN: ${{ github.token }}
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*codecollection.yaml
__pycache__
output.xml
log.html
report.html
dist
build
*egg-info
.kube
*.out





8 changes: 8 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This configuration file was automatically generated by Gitpod.
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
# and commit this file to your remote git repository to share the goodness with others.

# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart

tasks:
- init: pip install -r requirements.txt
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

99 changes: 99 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<!-- omit in toc -->

# Contributing to Runwhen Public CodeCollection

First off, thanks for taking the time to contribute! ❤️

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. 🎉

<!-- omit in toc -->

## Table of Contents

- [Code of Conduct](#code-of-conduct)
- [I Have a Question](#i-have-a-question)
- [I Want To Contribute](#i-want-to-contribute)
- [Reporting Bugs](#reporting-bugs)
- [Suggesting Enhancements](#suggesting-enhancements)
- [Your First Code Contribution](#your-first-code-contribution)
- [Improving The Documentation](#improving-the-documentation)
- [Styleguides](#styleguides)
- [Commit Messages](#commit-messages)
- [Join The Project Team](#join-the-project-team)

## Code of Conduct

This project and everyone participating in it is governed by the
[Runwhen Public CodeCollection Code of Conduct](https://github.com/runwhen-contrib/rw-workspace-utilsblob/master/CODE_OF_CONDUCT.md).
By participating, you are expected to uphold this code. Please report unacceptable behavior
to <[email protected]>.

## I Have a Question

> If you want to ask a question, we assume that you have read the available [Documentation](https://docs.runwhen.com/public/).
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.

If you then still feel the need to ask a question and need clarification, we recommend the following:

- Open an [Issue](https://github.com/runwhen-contrib/rw-workspace-utils/issues/new).
- Provide as much context as you can about what you're running into.
- Provide project and platform versions (Python, RobotFramework), depending on what seems relevant.

We will then take care of the issue as soon as possible.

## I Want To Contribute

> ### Legal Notice <!-- omit in toc -->
>
> 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.
### Reporting Bugs

<!-- omit in toc -->

#### How Do I Submit a Good Bug Report?

> 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]>.
We use GitHub issues to track bugs and errors. If you run into an issue with the project:

- 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.)
- Explain the behavior you would expect and the actual behavior.
- 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.
- Provide the information you collected in the previous section.

Once it's filed:

- The project team will label the issue accordingly.
- 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.
- 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).

### Suggesting Enhancements

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.

<!-- omit in toc -->

#### Before Submitting an Enhancement

- Make sure that you are using the latest version.
- Read the [documentation](https://docs.runwhen.com/public/) carefully and find out if the functionality is already covered, maybe by an individual configuration.
- 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.
- 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.

<!-- omit in toc -->

#### How Do I Submit a Good Enhancement Suggestion?

Enhancement suggestions are tracked as [GitHub issues](https://github.com/runwhen-contrib/rw-workspace-utils/issues).

- Use a **clear and descriptive title** for the issue to identify the suggestion.
- Provide a **step-by-step description of the suggested enhancement** in as many details as possible.
- **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.
- 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.
- **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.

## Attribution

This guide is based on the **contributing-gen**. [Make your own](https://github.com/bttger/contributing-gen)!
Loading

0 comments on commit bec6a00

Please sign in to comment.