DEV Community

Cover image for Auto change repo name with Github action
Tran Nguyen Thuong Truong
Tran Nguyen Thuong Truong

Posted on • Updated on

Auto change repo name with Github action

Introduction

  • I have just released repo that uses Github API and Github Action to watching to auto rename your repository through Variable Environment
  • After you click to the star repository button, the action workflow will be run, and after 60 seconds, the name and description of the repository will be updated to change.

Usage

  • 1 Create secret key ENV with name id RUN_TOKEN in setting -> developer setting
  • Create run.yml job file in .github/workflow folder
1. Default
  • Visit Autoname on Maket place
  • Click on Use latest version button
  • Copy the code below and paste it into your run.yml file
2. Self-host
name: "Run"

on:
  workflow_dispatch:
  watch:
    types: [started,fork]

jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v2
        with:
          path: ~/.npm
          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-node-
      - run: npm i
      - uses: ./
        with:
          githubToken: ${{ secrets.RUN_TOKEN }}
          actor: ${{ github.actor }}
Enter fullscreen mode Exit fullscreen mode

Options

  • See example action at here

Top comments (0)