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 slash command "/format" to automatically format PRs #646

Merged
merged 12 commits into from
Oct 24, 2020
Merged

Add slash command "/format" to automatically format PRs #646

merged 12 commits into from
Oct 24, 2020

Conversation

seisman
Copy link
Member

@seisman seisman commented Oct 9, 2020

Description of proposed changes

This PR adds a special github action to enable slash commands in comments. With the feature enabled, anyone, who have written permission to a pull request, can write /format at the first line of a comment to trigger the "format" action, which can format the codes automatically.

See #645 for context.

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If adding new functionality, add an example to docstrings or tutorials.

Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

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

Ok, I've added an APP_ID and APP_PRIVATE_KEY secret to the PyGMT repo which generates a token using the GenericMappingTools bot account:

image

See if the suggested changes work, not sure if it will work on your personal branch though @seisman, since the APP is installed only on GenericMappingTools/pygmt.

.github/workflows/format-command.yml Outdated Show resolved Hide resolved
.github/workflows/format-command.yml Outdated Show resolved Hide resolved
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

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

How about modifying the "Run make format and make check to make sure the code follows the style guide." line in https://github.com/GenericMappingTools/pygmt/blob/master/.github/PULL_REQUEST_TEMPLATE.md to mention the new /format command?

@seisman
Copy link
Member Author

seisman commented Oct 24, 2020

How about modifying the "Run make format and make check to make sure the code follows the style guide." line in https://github.com/GenericMappingTools/pygmt/blob/master/.github/PULL_REQUEST_TEMPLATE.md to mention the new /format command?

make check also runs flake8, and there is no way to format the codes following flake8 rules.

@seisman
Copy link
Member Author

seisman commented Oct 24, 2020

Perhaps we can add a note in the template like:

**Notes**

- You can write `/foramt` in the first line of a comment to automatically format your codes

@seisman
Copy link
Member Author

seisman commented Oct 24, 2020

Just made two more changes in 11b45b3 and 11b45b3

Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

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

Getting there!

.github/PULL_REQUEST_TEMPLATE.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
@weiji14 weiji14 added the maintenance Boring but important stuff for the core devs label Oct 24, 2020
@weiji14 weiji14 added this to the 0.2.1 milestone Oct 24, 2020
Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

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

Awesome, thanks for the good work @seisman, can't wait to try this out properly!

@seisman seisman marked this pull request as ready for review October 24, 2020 00:48
@seisman seisman merged commit d313015 into GenericMappingTools:master Oct 24, 2020
@seisman seisman mentioned this pull request Oct 24, 2020
5 tasks
@seisman seisman mentioned this pull request Nov 6, 2020
weiji14 added a commit that referenced this pull request Apr 27, 2021
The workflow ran on every GitHub issue and pull request
comments. This patch ensures that the the slash command
dispatch workflow is triggered by Pull Request comments
only. Patches #646.
weiji14 added a commit that referenced this pull request Apr 27, 2021
)

The workflow ran on every GitHub issue and pull request
comments. This patch ensures that the the slash command
dispatch workflow is triggered by Pull Request comments
only. Patches #646.
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
…nericMappingTools#1248)

The workflow ran on every GitHub issue and pull request
comments. This patch ensures that the the slash command
dispatch workflow is triggered by Pull Request comments
only. Patches GenericMappingTools#646.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants