Use GitHub Actions to automatically label Pull Requests #2420
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: None
Checklist
n/a
Description
We got access to GitHub Actions a while back when it was still beta-access only but unfortunately haven't used it yet (we initially wanted to use it for #982) and I want to start using it to implement some stuff, among others #2380 and simple-icons/simple-icons-font#1. However, I decided to start with something that is a bit simpler, namely:
Feature: Adding the labels
new icon
andupdated icon
to Pull Requests automatically based on the files added or changed in the Pull Request.1For those unfamiliar with GitHub Actions the file
.github/workflows/pull_requests.yml
defines a "workflow", which is analogous to a build defined in.travis.yml
. In it I say thaton: [pull_requests]
I want to do some stuff, run one or more "actions", namely I want torun(s-)on: ubuntu-latest
a step as defined byericcornelissen/labeler@master
. In the case of the "action" is configured by.github/labeler.yml
(which is a hard requirement from the "action" itself). The (currently incomplete) documentation for the configuration can be found in the project's README.I tested the workflow in my fork of this repository, you can see the final results in this Pull Request and this Pull Request (and a bunch more attempts in the list of closed Pull Requests).
Also, the action should run on this Pull Request, but it does nothing as the files changed don't match the globs in the configuration.Based on this article it looks like the actions won't start running until this is merged because this PR is coming from a fork (rather than this repo) so I hope it will start working 馃Why do this with GitHub Action rather than Travis CI? To try it out and learn, but also because I think it is easier to use and work with especially when you want to do stuff like in #2380. We don't need to move our Travis CI builds to GitHub Actions, but we could do that as well. Also, I like it very much that all the configuration is in the
.github/
directory 馃檭PS. I'm using my personal fork of actions/labeler (namely ericcornelissen/labeler) because I could not any labeling action that checked whether a file was added or changed (or removed for that matter). I do have an open issue regarding this feature to see if there is more interest, if so it may get merged and then we can update this action accordingly.
1: I would personally have preferred if multiple PR templates was a thing, just like multiple Issue templates are...