Skip to content

Commit c1f96a8

Browse files
committed
Update docs
1 parent b2f99eb commit c1f96a8

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ published through _PSGallery_.
1515

1616
### Usage
1717

18+
#### PowerShell Module
19+
1820
To get started with this module you will need an account on
1921
[WattTime](https://www.watttime.org/). See
2022
[the manual](https://www.watttime.org/api-documentation/#register-new-user)
@@ -64,3 +66,52 @@ point_time : 5-3-2023 14:15:00
6466
region : northeurope
6567
6668
```
69+
70+
#### GitHub Action
71+
72+
This PowerShell module also comes with a _GitHub Action_ you can use
73+
in your GitHub workflows. Again you will need a pre-existing account
74+
for _WattTime_ and an Azure CLI/PowerShell secret configured in your repo
75+
76+
**Example**
77+
78+
```yaml
79+
80+
on:
81+
pull_request:
82+
branches:
83+
- 'main'
84+
- 'releases/**'
85+
86+
name: Deploy to region with lowest emissions
87+
88+
jobs:
89+
deploy-to-test:
90+
runs-on: ubuntu-latest
91+
steps:
92+
- name: Checkout
93+
uses: actions/checkout@v3
94+
95+
- name: Login to Az PowerShell Module
96+
uses: azure/login@v1
97+
with:
98+
creds: ${{ secrets.AZURE_CREDENTIALS }}
99+
enable-AzPSSession: true
100+
101+
- name: Get region with lowest emissions
102+
uses: cloudyspells/PSWattTime@main
103+
id: watttime_action
104+
with:
105+
azure_credential: ${{ secrets.AZURE_CREDENTIALS }}
106+
watttime_username: ${{ secrets.WATTTIMEUSERNAME }}
107+
watttime_password: ${{ secrets.WATTTIMEPASSWORD }}
108+
regions: '"westeurope","northeurope","uksouth","francecentral","germanynorth"'
109+
110+
- uses: azure/arm-deploy@v1
111+
name: Run Bicep deployment
112+
with:
113+
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
114+
scope: subscription
115+
region: ${{ steps.watttime_action.outputs.region }}
116+
template: src/bicep/main.bicep
117+
```

0 commit comments

Comments
 (0)