Created
January 1, 2025 16:46
-
-
Save melamriD365/40f361a844de93abf6fe87caba1bff27 to your computer and use it in GitHub Desktop.
Github Action to run a PowerFx Script by using PAC CLI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: run-pfx-script | |
on: | |
workflow_dispatch: | |
inputs: | |
EnvironmentUrl: | |
description: "Environment URL (e.g., https://environment.crm.dynamics.com)" | |
required: true | |
jobs: | |
run-pfx-script: | |
runs-on: windows-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: true | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
- name: Install Power Platform CLI via .NET CLI | |
run: | | |
dotnet tool install --global Microsoft.PowerApps.CLI.Tool --version 1.29.11 | |
shell: pwsh | |
- name: Add .NET Global Tools to PATH | |
run: | | |
$dotnetToolsPath = "$env:USERPROFILE\.dotnet\tools" | |
echo "Adding $dotnetToolsPath to PATH" | |
echo "$dotnetToolsPath" >> $env:GITHUB_PATH | |
shell: pwsh | |
- name: Authenticate to Environment | |
run: | | |
pac auth create --name myEnv --environment ${{ github.event.inputs.EnvironmentUrl }} --applicationId ${{ secrets.APP_USER_ID }} --clientSecret ${{ secrets.APP_USER_SECRET }} --tenant ${{ secrets.TENANT_ID }} | |
shell: pwsh | |
- name: Select Environment | |
run: | | |
pac auth select --name myEnv | |
shell: pwsh | |
- name: Run Pfx Script | |
run: | | |
pac power-fx run --file ./pfx/Script.fx | |
shell: pwsh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment