8000 GitHub - cabljac/set-event-env
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

cabljac/set-event-env

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Set Event Data Environment Variable

GitHub release (latest by date)

This GitHub Action sets an environment variable with all the triggering event data as a stringified object. This allows you to pass event data to subsequent steps in your workflow, such as running scripts that require access to the full event payload.

Example Usage

To use this action, include it as a step in your GitHub Actions workflow. Here is an example workflow that sets up Node.js, caches dependencies, and runs a TypeScript script with the event data:

name: Example Workflow

on: 
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  run-script:
    runs-on: ubuntu-latest

    steps:
      - name: Check out repository
        uses: actions/checkout@v2

      - name: Set up Node.js
        uses: actions/setup-node@v2
        with:
          node-version: '14'

      - name: Cache Node.js modules
        uses: actions/cache@v2
        with:
          path: node_modules
          key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-node-

      - name: Install dependencies
        run: npm install

      - name: Set Event Data Environment Variable
        uses: cabljac/set-event-data@v0.0.1

      - name: Build TypeScript package
        run: npm run build
        working-directory: ./path-to-your-typescript-package

      - name: Run compiled script
        run: node lib/index.js
        working-directory: ./path-to-your-typescript-package
        env:
          GITHUB_EVENT: ${{ env.GITHUB_EVENT }}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0