Skip to content

Commit

Permalink
adding support to run twice (#64)
Browse files Browse the repository at this point in the history
* adding support to run twice

sometimes we add a new contributor on a run, and once we have basic metadata
a second PR is opened shortly after with this additional metadata (that we could
not look up before because we did not have them recorded). This change will add a new
variable run_twice to the action to allow the user to run the workflow twice
instead of once to reduce the updates to one PR.

Signed-off-by: vsoch <[email protected]>
  • Loading branch information
vsoch authored Mar 27, 2022
1 parent 0dc5c66 commit de944de
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are:
The versions coincide with releases on pip.

## [0.0.x](https://github.com/con/tributors/tree/master) (0.0.x)
- add to action ability to run command twice (0.0.21)
- searching orcid for other-names as final resort, requiring first/last (0.0.19)
- searching for last, first and reverse for orcid lookup (0.0.18)
- unicode characters allowed, and dont update users with orcids (0.0.17)
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ inputs:
allcontrib_skip_generate:
description: "skip running all-contributors generate"
default: false
run_twice:
description: "run twice to avoid opening two pull requests (defaults to true)"
default: true

runs:
using: docker
Expand Down
8 changes: 8 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,16 @@ if [ "${RUN_CODEMETA}" == "true" ]; then
fi

echo $COMMAND

# First time might just create content
$COMMAND

# Run twice to get additional metadata
if [ "${INPUT_RUN_TWICE:-true}" == "true" ]; then
printf "Running twice to get additional updates...\n"
$COMMAND
fi

# Finally, run all-contributors generate
if [ "${INPUT_ALLCONTRIB_SKIP_GENERATE}" == "false" ]; then
printf "Running all-contributors generate\n"
Expand Down
34 changes: 33 additions & 1 deletion docs/_docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -629,14 +629,46 @@ dashes.
| codemeta_file | the codemeta file to update, if defined | false | codemeta.json |
| mailmap_file | the mailmap file to use for update-lookup, if needed | false | .mailmap |
| update_lookup | one or more resources to use to update the .tributors file before running update | false | unset |
| run_twice | if you find the action opens two PRs, run the command twice so new folks are added and then metadata updated | false | true |

If you define `update_lookup`, you should list the (space separated) names of the parsers that you want to use. For example:

```yaml
update_lookup: mailmap zenodo
```
The same file names (e.g., *_file) will be used.
The same file names (e.g., *_file) will be used. Here is an example to update contributors, asking to not run twice.
```yaml
name: allcontributors-auto-detect

on:
push:
branches:
- main

jobs:
Update:
name: Generate
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Tributors Update
uses: con/tributors@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
parsers: unset
update_lookup: github
log_level: DEBUG
force: true
threshold: 1
run_twice: false
```
The above would be followed by a pull request action (e.g., commit and push to main branch
or open a pull request).
If you aren't familiar with all-contributors, you'll need to add some
Expand Down
2 changes: 1 addition & 1 deletion tributors/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"""

__version__ = "0.0.20"
__version__ = "0.0.21"
AUTHOR = "Vanessa Sochat"
AUTHOR_EMAIL = "[email protected]"
NAME = "tributors"
Expand Down

0 comments on commit de944de

Please sign in to comment.