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

First-time contributor github action #16762

Merged
merged 4 commits into from
Jul 31, 2019

Conversation

talldan
Copy link
Contributor

@talldan talldan commented Jul 26, 2019

Description

A github action that automatically labels opened pull requests with the 'First-time Contributor' label.

How has this been tested?

Testing isn't straightforward, requires docker locally but here are some steps!

  1. Create a fork of the gutenberg repo.
  2. Create a pull request on the fork using any branch.
  3. Clone the fork locally.
  4. In the folder for the clone, create a file event.json with the following content:
{
  "number":"1",
  "pull_request": {
    "user": {
      "login":"asdfasdfasd"
    }
  }
}

Make sure the number field represents the number for the PR created in step 2. Make the login field the random name of a user who has never committed to your fork of gutenberg.

  1. Generate a personal access token with the public_repo permission.
  2. Run the following commands, replacing INSERT_TOKEN_HERE with your token from step 5 and INSERT_REPO_HERE with the name of your fork from step 1 (e.g. talldan/gutenberg)
docker build .github/actions/first-time-contributor/ -t first-time-contributor
docker run -v `pwd`:`pwd` -w `pwd` -e GITHUB_EVENT_PATH=event.json -e GITHUB_TOKEN=INSERT_TOKEN_HERE -e GITHUB_REPOSITORY=INSERT_REPO_HERE -it first-time-contributor

Screenshots

Types of changes

New feature (non-breaking change which adds functionality)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@talldan talldan force-pushed the add/first-time-contributor-workflow branch 2 times, most recently from 9d61df0 to 1db1457 Compare July 26, 2019 07:25
@gziolo gziolo added the [Type] Project Management Meta-issues related to project management of Gutenberg label Jul 26, 2019
@talldan talldan self-assigned this Jul 26, 2019
@talldan talldan added the [Type] Enhancement A suggestion for improvement. label Jul 26, 2019
@talldan talldan force-pushed the add/first-time-contributor-workflow branch 4 times, most recently from bfee35e to 9028932 Compare July 30, 2019 08:58
@talldan talldan force-pushed the add/first-time-contributor-workflow branch from 9028932 to dfe852b Compare July 30, 2019 09:16

action "First Time Contributor" {
uses = "./.github/actions/first-time-contributor"
needs = ["Filter opened"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing it's ok for two workflows to use the same action?

@talldan talldan marked this pull request as ready for review July 30, 2019 09:19
@talldan talldan requested review from noisysocks and aduth July 30, 2019 09:20
pr_number=$(jq -r '.number' $GITHUB_EVENT_PATH)

if [ "$pr_number" = "null" ] || [ "$author" = "null" ]; then
echo "Could not find PR number or author. $pr_number / $author"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed whitespace here.

@talldan talldan merged commit 9160749 into master Jul 31, 2019
@talldan talldan deleted the add/first-time-contributor-workflow branch July 31, 2019 06:38
@talldan talldan added this to the Gutenberg 6.3 milestone Aug 1, 2019
gziolo pushed a commit that referenced this pull request Aug 29, 2019
* First draft of first-time contributor action

* Try using the github search api

* Minor tweaks
gziolo pushed a commit that referenced this pull request Aug 29, 2019
* First draft of first-time contributor action

* Try using the github search api

* Minor tweaks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Enhancement A suggestion for improvement. [Type] Project Management Meta-issues related to project management of Gutenberg
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants