Skip to content

Commit

Permalink
Add contributions to acknowledgement page (#217)
Browse files Browse the repository at this point in the history
(cherry picked from commit b1b7e26)

# Conflicts:
#	.github/workflows/pr-stats.yml
  • Loading branch information
christophfroehlich authored and mergify[bot] committed Jan 4, 2024
1 parent 4606a83 commit 86b7be5
Show file tree
Hide file tree
Showing 10 changed files with 602 additions and 88 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
reviewer-stats
path: ~/reviews
- name: Copy stats
run: ./make_help_scripts/add_review_stats
run: ./make_help_scripts/add_pr_stats
- uses: pre-commit/[email protected]
with:
extra_args: --all-files --hook-stage manual
50 changes: 50 additions & 0 deletions .github/workflows/pr-stats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: "Create PR Stats"

on:
workflow_dispatch:
pull_request: # run if the file changed on a PR to master
branches:
- master
paths:
- 'make_help_scripts/create_pr_stats.py'
push: # run if the file changed by pushes to master
branches:
- master
paths:
- 'make_help_scripts/create_pr_stats.py'
schedule:
# Run every morning to ensure component documentation is up to date on deployment
- cron: '23 3 * * *'

jobs:
create-pr-stats:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade --requirement requirements.txt
shell: bash
- name: Get stats
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python make_help_scripts/create_pr_stats.py
shell: bash
- name: Cache stats
uses: actions/cache/save@v3
with:
key: reviewer-stats-${{ github.run_id }}
path: ~/reviews
- name: Upload Artifacts
uses: actions/[email protected]
with:
name: pr-stats
path: ~/reviews
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ First, you need to fetch the reviewer stats from ros2_control org. To do so, you

```bash
export GITHUB_TOKEN=<your token>
python3 ./make_help_scripts/create_reviewer_stats.py
python3 ./make_help_scripts/create_pr_stats.py
```
which will create `~/reviews/reviewers_stats_with_graph.html`. Then you can build the documentation as usual, it will copy the file from this folder.

Expand Down
147 changes: 147 additions & 0 deletions _static/tabs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
try {
var session = window.sessionStorage || {};
} catch (e) {
var session = {};
}

window.addEventListener("DOMContentLoaded", () => {
const allTabs = document.querySelectorAll('.sphinx-tabs-tab');
const tabLists = document.querySelectorAll('[role="tablist"]');

allTabs.forEach(tab => {
tab.addEventListener("click", changeTabs);
});

tabLists.forEach(tabList => {
tabList.addEventListener("keydown", keyTabs);
});

// Restore group tab selection from session
const lastSelected = session.getItem('sphinx-tabs-last-selected');
if (lastSelected != null) selectNamedTabs(lastSelected);
});

/**
* Key focus left and right between sibling elements using arrows
* @param {Node} e the element in focus when key was pressed
*/
function keyTabs(e) {
const tab = e.target;
let nextTab = null;
if (e.keyCode === 39 || e.keyCode === 37) {
tab.setAttribute("tabindex", -1);
// Move right
if (e.keyCode === 39) {
nextTab = tab.nextElementSibling;
if (nextTab === null) {
nextTab = tab.parentNode.firstElementChild;
}
// Move left
} else if (e.keyCode === 37) {
nextTab = tab.previousElementSibling;
if (nextTab === null) {
nextTab = tab.parentNode.lastElementChild;
}
}
}

if (nextTab !== null) {
nextTab.setAttribute("tabindex", 0);
nextTab.focus();
}
}

/**
* Select or deselect clicked tab. If a group tab
* is selected, also select tab in other tabLists.
* @param {Node} e the element that was clicked
*/
function changeTabs(e) {
// Use this instead of the element that was clicked, in case it's a child
const notSelected = this.getAttribute("aria-selected") === "false";
const positionBefore = this.parentNode.getBoundingClientRect().top;
const notClosable = !this.parentNode.classList.contains("closeable");

deselectTabList(this);

if (notSelected || notClosable) {
selectTab(this);
const name = this.getAttribute("name");
selectNamedTabs(name, this.id);

if (this.classList.contains("group-tab")) {
// Persist during session
session.setItem('sphinx-tabs-last-selected', name);
}
}

const positionAfter = this.parentNode.getBoundingClientRect().top;
const positionDelta = positionAfter - positionBefore;
// Scroll to offset content resizing
window.scrollTo(0, window.scrollY + positionDelta);
}

/**
* Select tab and show associated panel.
* @param {Node} tab tab to select
*/
function selectTab(tab) {
tab.setAttribute("aria-selected", true);

// Show the associated panel
document
.getElementById(tab.getAttribute("aria-controls"))
.removeAttribute("hidden");
}

/**
* Hide the panels associated with all tabs within the
* tablist containing this tab.
* @param {Node} tab a tab within the tablist to deselect
*/
function deselectTabList(tab) {
const parent = tab.parentNode;
const grandparent = parent.parentNode;

Array.from(parent.children)
.forEach(t => t.setAttribute("aria-selected", false));

Array.from(grandparent.children)
.slice(1) // Skip tablist
.forEach(panel => panel.setAttribute("hidden", true));
}

/**
* Select grouped tabs with the same name, but no the tab
* with the given id.
* @param {Node} name name of grouped tab to be selected
* @param {Node} clickedId id of clicked tab
*/
function selectNamedTabs(name, clickedId=null) {
const groupedTabs = document.querySelectorAll(`.sphinx-tabs-tab[name="${name}"]`);
const tabLists = Array.from(groupedTabs).map(tab => tab.parentNode);

tabLists
.forEach(tabList => {
// Don't want to change the tabList containing the clicked tab
const clickedTab = tabList.querySelector(`[id="${clickedId}"]`);
if (clickedTab === null ) {
// Select first tab with matching name
const tab = tabList.querySelector(`.sphinx-tabs-tab[name="${name}"]`);
deselectTabList(tab);
selectTab(tab);
}
})
}

// TODO(christophfroehlich) this has to be uncommented for jQuery of our code to work on the same page

// if (typeof exports === 'undefined') {
// exports = {};
// }

// exports.keyTabs = keyTabs;
// exports.changeTabs = changeTabs;
// exports.selectTab = selectTab;
// exports.deselectTabList = deselectTabList;
// exports.selectNamedTabs = selectNamedTabs;
79 changes: 54 additions & 25 deletions doc/acknowledgements/acknowledgements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,71 @@ Acknowledgements

Maintainers
----------------
The following people were maintaining the ``ros2_control`` framework, showing their all-time review activity:
The following people were maintaining the ``ros2_control`` framework, showing their review activity and contributions:

.. raw:: html
:file: maintainers_stats.html
.. tabs::

Activity during the past 12 months:
.. tab:: Recent Contributions

.. raw:: html
:file: maintainers_stats_recent.html
Contributions during the past 12 months

Reviewers' Stats
----------------
The following people have contributed to the development of this project by giving valuable reviews for pull requests, see :ref:`doc/contributing/contributing:contributing` for more information.
.. raw:: html
:file: contributors_maintainers_stats_recent.html

.. tab:: All-Time Contrib

All-time contributions

.. raw:: html
:file: contributors_maintainers_stats.html

.. tab:: Recent Reviews

.. raw:: html
:file: reviewers_stats.html
Reviews during the past 12 months

Activity during the past 12 months:
.. raw:: html
:file: reviewers_maintainers_stats_recent.html

.. raw:: html
:file: reviewers_stats_recent.html
.. tab:: All-Time Reviews

All-time reviews

.. raw:: html
:file: reviewers_maintainers_stats.html

Contributors
----------------
The following people have contributed to the development of this project by providing valuable reviews or by submitting pull requests, see :ref:`doc/contributing/contributing:contributing` for more information.

.. tabs::

.. tab:: Recent Contributions

Contributions during the past 12 months

.. raw:: html
:file: contributors_stats_recent.html

.. tab:: All-Time Contrib

All-time contributions

.. raw:: html
:file: contributors_stats.html

.. tab:: Recent Reviews

Reviews during the past 12 months

.. raw:: html
:file: reviewers_stats_recent.html

.. tab:: All-Time Reviews

All-time reviews

The following links lists people who have contributed to the development of this project by submitting pull requests to the respective repository, see :ref:`doc/contributing/contributing:contributing` for more information.

* `ros2_control <https://github.com/ros-controls/ros2_control/graphs/contributors>`_
* `ros2_controllers <https://github.com/ros-controls/ros2_controllers/graphs/contributors>`_
* `ros2_control_demos <https://github.com/ros-controls/ros2_control_demos/graphs/contributors>`_
* `control_toolbox <https://github.com/ros-controls/control_toolbox/graphs/contributors>`_
* `gazebo_ros2_control <https://github.com/ros-controls/gazebo_ros2_control/graphs/contributors>`_
* `gz_ros2_control <https://github.com/ros-controls/gz_ros2_control/graphs/contributors>`_
* `realtime_tools <https://github.com/ros-controls/realtime_tools/graphs/contributors>`_
* `kinematics_interface <https://github.com/ros-controls/kinematics_interface/graphs/contributors>`_
* `control_msgs <https://github.com/ros-controls/control_msgs/graphs/contributors>`_
.. raw:: html
:file: reviewers_stats.html


Companies and Institutions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi
. "$DIR/deploy_defines" || { echo "Could not source deploy_defines script. This is needed for correct execution. Exiting!"; exit; }

add_reviewer_stats_file
add_pr_stats_file
2 changes: 1 addition & 1 deletion make_help_scripts/add_sub_repos
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ add_sub_repositories () {
}

add_sub_repositories
add_reviewer_stats_file
add_pr_stats_file
2 changes: 1 addition & 1 deletion make_help_scripts/add_tmp_commits
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ add_sub_repositories_and_commit () {
rm -rf .git/
cd ../../
done
add_reviewer_stats_file
add_pr_stats_file
git add .
# we don't want to use-precommit to check if subrepos are correct
git commit -m "Add temporary changes for multi version" --no-verify 1> /dev/null
Expand Down
Loading

0 comments on commit 86b7be5

Please sign in to comment.