Skip to content

Commit 4d615d3

Browse files
committed
initial
0 parents  commit 4d615d3

16 files changed

+414
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Generate Terraform Docs
2+
#on:
3+
# push:
4+
# branches: [ "master" ]
5+
6+
on:
7+
workflow_call:
8+
9+
permissions:
10+
repository-projects: write
11+
actions: write
12+
checks: write
13+
contents: write
14+
deployments: write
15+
id-token: write
16+
17+
jobs:
18+
reusable-docs-wf:
19+
runs-on: ubuntu-latest # Run the workflow on an Ubuntu runner
20+
21+
steps:
22+
- uses: actions/checkout@v3 # Checkout the repository code
23+
24+
- name: Install Terraform Docs
25+
uses: terraform-docs/gh-actions@main # Action to generate Terraform documentation
26+
with:
27+
working_dir: . # Use the current directory (adjust if needed)
28+
output-file: README.md # Update the README file with generated docs
29+
output-method: inject # Inject the documentation into the README
30+
git-push: "true"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Testing configuration Variables
2+
3+
on:
4+
workflow_dispatch
5+
6+
env:
7+
cloud: google-cloud
8+
9+
jobs:
10+
greeting_job:
11+
runs-on: ubuntu-latest
12+
env:
13+
Greeting: Hello
14+
steps:
15+
- name: "Say Hello to Vishal"
16+
run: echo "$Greeting $First_Name is using $cloud with project ${{ vars.PROJECT_ID }}!"
17+
env:
18+
First_Name: Vishal
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Testing Context Variables
2+
3+
on:
4+
workflow_dispatch
5+
6+
env:
7+
cloud: google-cloud
8+
9+
jobs:
10+
test_context_variables:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: "Checking Context Variable"
14+
run: |
15+
echo "Repository Name : ${{ github.repository }}"
16+
echo "Workflow Name : ${{ github.workflow }}"
17+
echo "Triggered by : ${{ github.triggering_actor }}"
18+

.github/workflows/demo.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: First Workflow
4+
5+
# Controls when the workflow will run (event)
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the "master" branch
8+
push:
9+
branches: [ "master" ]
10+
pull_request:
11+
branches: [ "master" ]
12+
13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
15+
16+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17+
jobs:
18+
# This workflow contains a single job called "build"
19+
build:
20+
# The type of runner that the job will run on
21+
runs-on: ubuntu-latest
22+
23+
# Steps represent a sequence of tasks that will be executed as part of the job
24+
steps:
25+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
26+
- uses: actions/checkout@v4
27+
28+
# Runs a single command using the runners shell
29+
- name: Run a one-line script
30+
run: echo Hello, Learning Github Actions!!
31+
32+
# Runs a set of commands using the runners shell
33+
- name: Run a multi-line script
34+
run: |
35+
echo Add other actions to build,
36+
echo test, and deploy your project.

.github/workflows/manual.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This is a basic workflow that is manually triggered
2+
3+
name: Manual workflow
4+
5+
# Controls when the action will run. Workflow runs when manually triggered using the UI
6+
# or API.
7+
on:
8+
workflow_dispatch:
9+
# Inputs the workflow accepts.
10+
inputs:
11+
name:
12+
# Friendly description to be shown in the UI instead of 'name'
13+
description: 'Person to greet'
14+
# Default value if no value is explicitly provided
15+
default: 'World'
16+
# Input has to be provided for the workflow to run
17+
required: true
18+
# The data type of the input
19+
type: string
20+
21+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
22+
jobs:
23+
# This workflow contains a single job called "greet"
24+
greet:
25+
# The type of runner that the job will run on
26+
runs-on: ubuntu-latest
27+
28+
# Steps represent a sequence of tasks that will be executed as part of the job
29+
steps:
30+
# Runs a single command using the runners shell
31+
- name: Send greeting
32+
run: echo "Hello ${{ inputs.name }}"

.github/workflows/secrets.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Testing Secret Variables
2+
3+
on:
4+
workflow_dispatch
5+
env:
6+
ACTIONS_STEP_DEBUG: true
7+
jobs:
8+
test_context_variables:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: "Checking Secret Variable"
12+
run: |
13+
echo "Secret Value : ${{ secrets.MY_KEY }}"
14+
${{ secrets.MY_KEY }}
15+

.github/workflows/self_hosted.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: First Workflow
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the "master" branch
8+
push:
9+
branches: [ "master" ]
10+
pull_request:
11+
branches: [ "master" ]
12+
13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
15+
16+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17+
jobs:
18+
# This workflow contains a single job called "build"
19+
build:
20+
# The type of runner that the job will run on
21+
runs-on: self-hosted
22+
23+
# Steps represent a sequence of tasks that will be executed as part of the job
24+
steps:
25+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
26+
- uses: actions/checkout@v4
27+
28+
# Runs a single command using the runners shell
29+
- name: Run a one-line script
30+
run: echo Hello, Learning Github Actions!!
31+
32+
# Runs a set of commands using the runners shell
33+
- name: Run a multi-line script
34+
run: |
35+
echo Add other actions to build,
36+
echo test, and deploy your project.

.github/workflows/terraform.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: 'Terraform'
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
8+
permissions:
9+
repository-projects: write
10+
actions: write
11+
checks: write
12+
contents: write
13+
deployments: write
14+
id-token: write
15+
16+
jobs:
17+
call-workflow-passing-data:
18+
uses: vishal-bulbule/github-action-demo/.github/workflows/automate-readme.yml@master
19+
terraform:
20+
name: 'Terraform'
21+
runs-on: ubuntu-latest
22+
23+
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
24+
defaults:
25+
run:
26+
shell: bash
27+
28+
steps:
29+
# Checkout the repository to the GitHub Actions runner
30+
- name: Checkout
31+
uses: actions/checkout@v3
32+
33+
# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token
34+
- name: Setup Terraform
35+
uses: hashicorp/setup-terraform@v2
36+
with:
37+
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
38+
39+
# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
40+
- name: Terraform Init
41+
run: terraform init
42+
43+
44+
# Generates an execution plan for Terraform
45+
#- name: Terraform Plan
46+
# run: terraform plan -input=false
47+
48+
49+
# On push to "main", build or change infrastructure according to Terraform configuration files
50+
# Note: It is recommended to set up a required "strict" status check in your repository for "Terraform Cloud". See the documentation on "strict" required status checks for more information: https://help.github.com/en/github/administering-a-repository/types-of-required-status-checks
51+
#- name: Terraform Apply
52+
# run: terraform apply -auto-approve -input=false

.github/workflows/user_input.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test User Input workflow
2+
3+
# Controls when the action will run. Workflow runs when manually triggered using the UI or API.
4+
on:
5+
workflow_dispatch:
6+
# Inputs the workflow accepts.
7+
inputs:
8+
number1:
9+
# Friendly description to be shown in the UI instead of 'number1'.
10+
description: 'First number'
11+
# Default value if no value is explicitly provided.
12+
default: '0'
13+
# Input has to be provided for the workflow to run.
14+
required: true
15+
# The data type of the input.
16+
number2:
17+
# Friendly description to be shown in the UI instead of 'number2'.
18+
description: 'Second number'
19+
# Default value if no value is explicitly provided.
20+
default: '0'
21+
# Input has to be provided for the workflow to run.
22+
required: true
23+
# The data type of the input.
24+
25+
jobs:
26+
add_numbers:
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Add numbers
31+
id: sum
32+
run: echo "::set-output name=sum::$((${{ inputs.number1 }} + ${{ inputs.number2 }}))"
33+
34+
- name: Display sum
35+
run: echo "The sum of ${{ inputs.number1 }} and ${{ inputs.number2 }} is ${{ steps.sum.outputs.sum }}"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Testing Workflow Variables
2+
3+
on:
4+
workflow_dispatch
5+
6+
env:
7+
cloud: google-cloud
8+
9+
jobs:
10+
greeting_job:
11+
runs-on: ubuntu-latest
12+
env:
13+
Greeting: Hello
14+
steps:
15+
- name: "Say Hello Mona it's Monday"
16+
run: echo "$Greeting $First_Name is using $cloud!"
17+
env:
18+
First_Name: Vishal
19+

0 commit comments

Comments
 (0)