DEV Community

Arya Narayan Tiwari
Arya Narayan Tiwari

Posted on • Updated on

Hacktoberfest Action

My Workflow

I created my workflow by customizing the pr-labeler github action by TimonVS on github action marketplace. This workflow works by matching branch patterns name such that whenever a branch with matching pattern makes a pull request and when that branch is merged and closed it adds the hacktoberfest and hacktoberfest-accepted label to the PRs, which automates the task for hacktoberfest maintainers to manually add the labels.

What the workflow does ?

When a pull request is closed with the branch name hack/[anything] the Action will automatically apply the hacktoberfest and hacktoberfest-acccepted label once the PR is merged.

Example

  1. I created a new file index.js in a new branch with the matching pattern name hack/test then committed the change and opened a pull request to the master branch. Pull Request
  2. As you can see currently there are no labels assigned to the pull request also no workflow has been run yet.

  3. Now I merge the PR to the master branch to run the worklfow.
    Merge to Master

  4. The merge action here triggers the workflow
    Workflow

  5. Finally when the pull request is closed and merged the labels hacktoberfest and hacktoberfest-accepted have been added to the pull request.
    Labels Added

Submission Category: Maintainer Must-Haves

Yaml File or Link to Code

  • Github Repository Link

GitHub logo aryanarayantiwari / hacktoberfest-action

This is a github action that adds hacktoberfest and hacktoberfest-accepted label to a merged pull request with matching branch name patterns.

Hacktoberfest Action

Merge pull request with ease

This is a github action made by using and customizing the pr-labeler github action by TimonVS from the github actions marketplace.

Features

  • Add labels to pull request with matching patterns in branch-name.
  • Automatically adds the lables once the PR is merged.
  • The current matching pattern for branchname is 'hack/*' but one can customise it by editing the 'pr-labeler.yml' file in .github folder.
  • Easy to Use
  • Automates the task of adding labels manually to a PR while merging during Hacktoberfest

Usage

Add .github/workflows/pr-labeler.yml with the following:

name: PR Labeler
on:
  pull_request:
    types: [closed]

jobs:
  pr-labeler:
    if: github.event.pull_request.merged == true
    runs-on: ubuntu-latest
    steps:
      - uses: TimonVS/pr-labeler-action@v3
        with:
          configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Enter fullscreen mode Exit fullscreen mode

Configuration

Configure by creating a .github/pr-labeler.yml file.

For example:

hacktoberfest
Enter fullscreen mode Exit fullscreen mode
  • Yaml File
name: PR Labeler
on:
  pull_request:
    types: [closed]

jobs:
  pr-labeler:
    if: github.event.pull_request.merged == true
    runs-on: ubuntu-latest
    steps:
      - uses: TimonVS/pr-labeler-action@v3
        with:
          configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Enter fullscreen mode Exit fullscreen mode

Additional Resources / Info

TimonVS PR-labeler

Oldest comments (0)