Skip to content

Read files action

Actions
Read files content
v1.5
Latest
Star (5)

read-files-action

Reads the content of files which match the pattern.

Usage

steps:
  - name: Read migrations
    id: migrations
    uses: komorebitech/[email protected]
    with:
      files: '["/migrations/001_initial.py", "/migrations/002_auto_2020_08_11_545462.py"]'
  - name: Echo migrations
    run: echo "${{ steps.migrations.outputs.content }}"

Example Usecase

Here is an example if you want to get all the changes in the migration files of a project and notify some of your team members about the schema changes. It gets changed files using an action, reads the content of the new migration files using this action and then sends emails to a list.

name: Detect Schema Change

on:
  pull_request:
    types: [closed]
    branches:
      - master
    paths:
      - '**migrations**'

jobs:
  detect-schema-change:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2
    - uses: lots0logs/[email protected]
      id: get_changed_files
      with:
        token: "${{secrets.GITHUB_TOKEN}}"
    - uses: komorebitech/[email protected]
      id: read_migration_files
      with:
        files: ${{ steps.get_changed_files.outputs.added }}
        pattern: 'migrations'
    - name: Send email
      uses: dawidd6/action-send-mail@v2
      with:
        server_address: ${{secrets.SMTP_SERVER}}
        server_port: ${{secrets.SMTP_PORT}}
        username: ${{secrets.SMTP_USER}}
        password: ${{secrets.SMTP_PASSWORD}}
        subject: Database Schema Changed
        to: [email protected], [email protected]
        from: "Team Example <[email protected]>"
        content_type: text/plain
        body: ${{ steps.read_migration_files.outputs.content }}

License

MIT

Read files action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Read files content
v1.5
Latest

Read files action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.