Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/snowdrop/export-github-flows

Project to test github actions and jobs
https://github.com/snowdrop/export-github-flows

Last synced: 5 days ago
JSON representation

Project to test github actions and jobs

Awesome Lists containing this project

README

        








# Export "e2e" github workflows

This project aims to read [github workflows](https://docs.github.com/en/actions/quickstart) and to export in a txt file the `env` and `run` sections.

Why ? As the goal of a 2e2 test, played by a GitHub workflow, is to verify if the scenario which requires to potentially install many
components on the platform (kubernetes cluster, certificate manager, tekton pipeline, service binding, vault, crossplane etc)
works, the information such as `run:` or `run: |` or environment variables set `env:` could be more than valuable
for local debugging, fine-tuning, demo purposes.

To play with it and export the information in a file, you can then use the following bash script and pass as parameter the file to be processed:
```bash
./scripts/export-jobs.sh
```
The script will then read the file and export the environment variables and each `run` block

Example of flow:
```yaml
name: gitHub Workflow sample

on:
push:
branches: [ main ]
paths-ignore:
- '*.md' # Ignores .md files at the root of the repository
- '**/*.md' # Ignores .md files within subdirectories

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
job1:
env:
FIRST_NAME: Mona
LAST_NAME: Lisa

steps:
- name: Install Dependencies
run: npm install

- name: Clean install dependencies and build
run: |
npm ci
npm run build

- name: Clean temp directory
run: rm -rf *
working-directory: ./temp
```

And what we got:

**Important**: Some hacking will be needed as the script cannot figure out what the [GitHub default variables](https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables) are
and cannot perform substitution too.

Example:
```yaml
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
Generated into:

Enjoy to play with this project and improve it ;-)