Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add usercff workflow #529

Merged
merged 6 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/issue_template_user_kudos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: User Kudos
about: Share appreciation for the project!
title: Add new user to USERS.cff
labels: user
assignees: ''

---

Thanks for supporting the project and helping to improve its recognition by joining USERS.cff.
It helps the project quite a bit!

We will add you to the list of valued users.

Please, insert your information between the double quotes below - fill out at minimum "affiliation" :purple_heart:

family-names: ""
given-names: ""
alias: ""
affiliation: ""
orcid: ""

Thank you!
88 changes: 88 additions & 0 deletions .github/workflows/extend_user_cff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: create-pr-to-add-user-to-usercff

on:
workflow_dispatch:
issues:
types: [opened, labeled]

permissions:
contents: write
pull-requests: write

jobs:
create-pr-to-add-new-user:
if: contains(join(github.event.issue.labels.*.name, ','), 'user')
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# checkout to develop branch of repo
ref: develop

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Extract issue details
id: extract_details
run: |
echo "Extracting issue details..."
ISSUE_BODY="${{ github.event.issue.body }}"
echo "Issue body content:"
echo "$ISSUE_BODY"

# Extract information
FAMILY_NAMES=$(echo "$ISSUE_BODY" | grep '^family-names:' | sed 's/family-names: //')
GIVEN_NAMES=$(echo "$ISSUE_BODY" | grep '^given-names:' | sed 's/given-names: //')
ALIAS=$(echo "$ISSUE_BODY" | grep '^alias:' | sed 's/alias: //')
AFFILIATION=$(echo "$ISSUE_BODY" | grep '^affiliation:' | sed 's/affiliation: //')
ORCID=$(echo "$ISSUE_BODY" | grep '^orcid:' | sed 's/orcid: //')

# Delete new lines and add to env variables
echo "FAMILY_NAMES=$(echo -n $FAMILY_NAMES | tr -d '\n')" >> $GITHUB_ENV
echo "GIVEN_NAMES=$(echo -n $GIVEN_NAMES | tr -d '\n')" >> $GITHUB_ENV
echo "ALIAS=$(echo -n $ALIAS | tr -d '\n')" >> $GITHUB_ENV
echo "AFFILIATION=$(echo -n $AFFILIATION | tr -d '\n')" >> $GITHUB_ENV
echo "ORCID=$(echo -n $ORCID | tr -d '\n')" >> $GITHUB_ENV

- name: Debug extracted values
run: |
echo "Family Names: ${{env.FAMILY_NAMES}}"
echo "Given Names: ${{env.GIVEN_NAMES}}"
echo "Alias: ${{env.ALIAS}}"
echo "Affiliation: ${{env.AFFILIATION}}"
echo "ORCID: ${{env.ORCID}}"

- name: Update USERS.cff
run: |
# double quotes are not added, due to formatting hell. Double quotes will cause the creation of additional unwanted new lines, even when checked out as \"
tee -a USERS.cff <<EOF
- family-names: ${{env.FAMILY_NAMES}}
given-names: ${{env.GIVEN_NAMES}}
alias: ${{env.ALIAS}}
affiliation: ${{env.AFFILIATION}}
orcid: ${{env.ORCID}}
EOF


- name: Print updated USERS.cff
run: cat USERS.cff

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
base: develop
head: workflow-${{ github.event.issue.number }}-update-users-cff
branch: workflow-${{ github.event.issue.number }}-update-users-cff
title: 'Update USERS.cff with new user information'
commit-message: |
Add new user to USERS.cff
body: |
This pull request updates the USERS.cff file with new user information extracted from issue #${{ github.event.issue.number }}

Closes #${{ github.event.issue.number }}

Many thanks ${{ github.actor }}!
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and the versioning aims to respect [Semantic Versioning](http://semver.org/spec/
### Added
- Extend documentation section `getting started` based on the JOSS Review [#523](https://github.com/OpenEnergyPlatform/open-MaStR/pull/523)
- Extend and repair documentation based on the JOSS Review [#527](https://github.com/OpenEnergyPlatform/open-MaStR/pull/527)
- Add issue template and workflow to populate USERS.cff [#528](https://github.com/OpenEnergyPlatform/open-MaStR/pull/529)
### Changed
- Change License identifier for pypi [#525](https://github.com/OpenEnergyPlatform/open-MaStR/pull/525)
- Change header to identify as open-mastr during http request [#526](https://github.com/OpenEnergyPlatform/open-MaStR/pull/526)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Please be self-reflective and always maintain a good culture of discussion and a
Since the open license allows free use, no notification is required.
However, for the authors it is valuable information who uses the software for what purpose.
Indicators are `Watch`, `Fork` and `Starred` of the repository.
If you are a user, please add your name and details in [USERS.cff](https://github.com/OpenEnergyPlatform/open-MaStR/blob/production/USERS.cff)
If you are a user, please add your name and details in [USERS.cff](https://github.com/OpenEnergyPlatform/open-MaStR/blob/production/USERS.cff) by using the [issue template](https://github.com/OpenEnergyPlatform/open-MaStR/issues/new?assignees=&labels=user&projects=&template=user-kudos.md&title=Add+new+user+to+USERS.cff).

### B. Comment
You can give ideas, hints or report bugs in issues, in PR, at meetings or other channels.
Expand Down
10 changes: 5 additions & 5 deletions USERS.cff
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cff-version: 1.2.0
message: "If you use this software, please leave your name for reference.
authors:
- family-names: ""
given-names: ""
alias: ""
affiliation: "Reiner Lemoine Institut"
orcid: ""
- family-names:
given-names:
alias:
affiliation: Reiner Lemoine Institut
orcid: