Skip to content
settings

GitHub Action

rice-action

1.0.0 Latest version

rice-action

settings

rice-action

Repository infrastructure as code

Installation

Copy and paste the following snippet into your .yml file.

              

- name: rice-action

uses: flex-development/repostructure-action@1.0.0

Learn more about this action in flex-development/repostructure-action

Choose a version

🍚 rice-action

infrastructure codecov module type: esm license conventional commits typescript vitest yarn

Repository infrastructure as code

Contents

What is this?

GitHub Action for managing repository infrastructure.

When should I use this?

This action can be used to manage repository infrastructure.

The following setting groups are supported:

Use

- uses: flex-development/rice-action@<VERSION>
  with:
    # Location of repository infrastructure configuration file
    # default: .github/infrastructure.yml
    config: .github/infrastructure.yml
    # Personal access token (PAT) used to authenticate GitHub API requests
    # default: ${{ github.token }}
    token: ${{ secrets.PAT_REPO }}

Scenarios

Admin-only infrastructure updates

Update repository infrastructure on push or workflow_dispatch when the infrastructure config file (or workflow) is updated. The user triggering the workflow run (github.actor) must be a repository admin.

See .github/workflows/infrastructure.yml for more details.

---
name: infrastructure
on:
  create:
    branches:
      - main
  push:
    branches:
      - main
      - release/**
    paths:
      - .github/infrastructure.yml
      - .github/workflows/infrastructure.yml
  workflow_dispatch:
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
jobs:
  infrastructure:
    runs-on: ubuntu-latest
    steps:
      - id: debug
        name: Print environment variables and event payload
        uses: hmarr/debug-action@v2.1.0
      - id: check-actor-permission
        name: Check permission of actor ${{ github.actor }}
        uses: actions-cool/check-user-permission@v2.2.0
        with:
          require: admin
          username: ${{ github.actor }}
      - id: checkout
        name: Checkout ${{ github.ref_name }}
        uses: actions/checkout@v3.3.0
        with:
          persist-credentials: false
          ref: ${{ github.ref_name }}
      - id: update
        if: steps.check-actor-permission.outputs.require-result == 'true'
        name: Update repository infrastructure
        uses: flex-development/rice-action@<VERSION>
        with:
          token: ${{ secrets.PAT_REPO }}

API

Inputs

config

Location of repository infrastructure configuration file.

Default: .github/infrastructure.yml

token

Personal access token (PAT) used to authenticate GitHub API requests.

Default: ${{ github.token }}

Types

This action is fully typed with TypeScript.

Contribute

See CONTRIBUTING.md.