Giter VIP home page Giter VIP logo

autodev-action's Introduction

๐Ÿ‘ท AutoDev Action

Continuous Integration GitHub release (latest by date)

This action merges commits from different pull requests that have been tagged with the label dev into the dev branch on your GitHub repository.

name: Autodev
on:
  push:
    branches-ignore:
      - dev
  pull_request:
    types: [labeled, unlabeled, closed]

jobs:
  autodev:
    name: Build Dev Branch
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          # The token of the user that should perform the merges. 
          # This must be a personal access token with the necessary permissions
          token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
          fetch-depth: 0

      - name: Autodev
        uses: Staffbase/[email protected]
        with:
          # The token used to fetch the pull requests from the GitHub API
          token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

All options

You can find all input options which are available for this action.

Input Description Default
token PAT for GitHub API authentication
base This is the base branch. The merge history originates from this branch. main
branch The branch the action will merge the pull requests to. dev
label The label where the action will be triggered. dev
comments The GitHub action creates a new comment inside every pull request. false
success_comment Comment string that will be shown in the pull request on success. Only necessary if comments is enabled. ''
failure_comment Comment string that will be shown in the pull request on failure. Only necessary if comments is enabled. ''
labels The GitHub action updates the labels inside every pull request for successful or failed merges to the dev branch. false
success_label Label string that will be shown on the Pull request on success. Only necessary if labels is enabled. successful
failure_label Label string that will be shown on the Pull request on failure. Only necessary if labels is enabled. failed
user Name of the user which does the git commit. AutoDev Action
email E-Mail of the user which does the git commit. [email protected]

Example Usages

Always create the dev branch.

- name: Autodev
  uses: Staffbase/[email protected]
  with:
    token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

Add a status comment if the merge was successful or failed.

- name: Autodev
  uses: Staffbase/[email protected]
  with:
    token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
    comments: true
    success_comment: '๐ŸŽ‰ The action successfully merged all branches with the dev label.'
    failure_comment: 'โš ๏ธ Something went wrong.'

Add a status label if the merge was successful or failed.

- name: Autodev
  uses: Staffbase/[email protected]
  with:
    token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
    labels: true
    success_label: 'successful'
    failure_label: 'failed'

Limitations

  • currently only the first 100 pull requests are analyzed

Release

You can create a new release by creating a new tag and bump the version in package.json.

Development

Very nice that you want to work on the action. To create a working implementation, you can use the following command to perform all the necessary actions.

npm run all
Staffbase GmbH Staffbase GmbH
Staffbase is an internal communications platform built to revolutionize the way you work and unite your company. Staffbase is hiring: jobs.staffbase.com
GitHub | Website | Jobs

autodev-action's People

Contributors

0x46616c6b avatar dependabot[bot] avatar flaxel avatar franzuhlig avatar pofl avatar staffbase-robert avatar stefanmeschke avatar stummi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

stummi

autodev-action's Issues

Using library to execute git commands

Feature Suggestion

  • using a library to execute the git commands

Possible Implementation

  • found one library as possible implementation
  • take a look at some more alternatives

Context

  • don't execute the commands bare

Enable debug logging

Feature Suggestion

  • add missing debug loggings to get a better overview if the action fails

Possible Implementation

  • there is a good documentation from GitHub with the usage of debug

GitHub-Autolink Spam on large Repositories

Summary

On bigger repositories, with many dev'ed PRs in parallel, the status comments of this action link all of them as intended.
However this leads to a GitHub annotating each of the PRs with all the other PRs. This is due to GitHub autolinker recognizing the PR-Links and annotating the linked PR with something like "This PR was mentioned in PR".

Feature Suggestion

The Status Comments are nice and give a good feedback of what the action produced, so disabling the comments is not the optimal Solution here.
We should provide a way to reduce the AutoLink spam without giving away the comments nicities.

Possible Implementation

I was thinking about some kind of templating we can provide for the action. So we can give the Users the ability to Structure the comments themselves.
This is the way for example release-drafter/release-drafter handles dynamic outputs.
So we use some kind of templating Engine (e.g. go-template) and provide the users a documentation of what parameters we compile into the Template. This way they can leave out what they want to leave out, or can even use handmade messages for the Comments โœจ ๐ŸŽจ

Configure Workflows/Checks to be successful before considering marked PR for merge

Feature Suggestion

Possibility to configure workflows and checks to be successful before merging pull requests to dev-branch

Possible Implementation

Check the PR workflows/checks and get the status of either a pre-configured list of checks and/or all checks which are required for merge. The second option might be easier to configure at the auto dev action, as it would be just a boolean flag, with the downside that e.g. sonarcube also might prevent the "deving".

Context

Currently pull request with a broken CI pipeline are blocking the auto deving flow as also CI on dev branch is breaking. Often you need then to wait for other PRs to be fixed or "un-deved". By only considering PRs with successful CI pipeline, we could prevent this.

Action fails when no dev branch exists

Bug Description

When adding the action to a new repository, it fails when there is no "dev" branch yet.

Expected Behavior

The action should just create one. Doesn't matter where IMHO, it's force-pushed anyway.

How to Reproduce

Create a new repo and try to add this action.

Context

n/a

Environment

(in a company-internal repository, please contact via Slack if interested)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.