Exercise - Use GitHub Actions for Microsoft Power Platform

Completed

In this exercise, you'll export a solution that contains a custom connector into GitHub by using GitHub Actions for Microsoft Power Platform.

Important

Use a test environment with Microsoft Dataverse provisioned. If you don't have one, you can sign up for the Community Plan. A GitHub account is also required to complete the exercise. You can sign up for one for free at GitHub.com.

Note

Download the following file to your local computer to complete this exercise: Contoso Invoicing ALM. Select the download button on the middle-right of the screen.

Task 1: Import solution

In this task, you'll import an unmanaged solution that contains a Contoso Invoicing custom connector. You'll use this connector to complete the tasks in this exercise.

  1. Go to Power Apps maker portal and make sure that you are in the correct environment.

  2. Select Solutions and then select Import solution.

  3. Select Browse.

  4. Select the ContosoInvoicingALM_1_0_0_0.zip solution and then select Open.

  5. Select Next.

  6. Select Import and then wait for the import to complete. You should get a success message after the import completes.

  7. Select Publish all customizations and then wait for the publish to complete.

  8. Select the Contoso Invoicing - ALM solution that you imported.

    You should see the Contoso Invoicing - ALM custom connector component.

  9. In the upper-right corner of the screen, select the Settings icon and then select Session details.

    Screenshot showing selecting session details.

  10. In the Power Apps session details dialog box, select the Instance url value and copy it for use later in the exercise.

    Screenshot showing session details and where to find the instance URL value.

Task 2: Create a GitHub repository

To create a GitHub repository, follow these steps:

  1. Go to GitHub and select Create repository.

  2. Enter ContosoInvoiceALM for the repository name.

  3. Select Add a README file.

  4. Select Create repository.

  5. In the new repository, select the Settings icon.

  6. Expand the Secrets and variables section and select Actions. Secrets are environment variables that are encrypted. Anyone with collaborator access to this repository can use these secrets for GitHub Actions. You'll create three secrets that will ensure that the action that you create doesn't have sensitive information in it.

  7. Select New repository secret.

  8. Enter environment in the Name field.

  9. Paste the environment URL that you copied in the previous task in the Secret field.

    Screenshot showing adding a new action secret.

  10. Select Add Secret.

  11. Add another secret with a name of user with the Secret** containing the email of the account that you use to access the environment.

  12. Add another secret with a name of password with the Secret containing the password of the account that you use to access the environment.

  13. After you've added the secrets, your list of values should look like the following screenshot.

    Screenshot showing the three actions that you added environment, password, user.

  14. Expand Actions and select General

    Screenshot showing the actions general link button.

  15. Scroll down to the Workflow permissions section, select the Read and write permission, and then select Save.

    Screenshot showing the workflow permissions section.

Task 3: Create a GitHub Action

To create a GitHub Action, follow these steps:

  1. In the repository navigation, select the Action menu item.

    Screenshot showing selecting actions.

  2. Select the setup a workflow yourself option.

    Screenshot showing set up your own workflow being selected.

  3. Open the provided export-and-branch-solution.yml file and paste the contents into the Edit new file area.

    Screenshot showing pasting in the new action steps.

  4. You've added the following four steps: 1) Who-am-I action to test connection, 2) Export solution, 3) Unpack the solution, and 4) Create a branch and check in the solution files.

    Screenshot showing the steps outlined above.

  5. Select Start commit on the right side and then select Commit new file. This step will save the action that you built.

    Screenshot showing start commit and commit new file actions being selected.

Your action has been saved and is ready to run.

Task 4: Run the export action

To run the export action, follow these steps:

  1. Go to the Actions repository.

    Screenshot showing selecting actions to see the list.

  2. Select the export-and-branch-solution action and then select Run workflow.

    Screenshot showing selecting the action that you created and selecting run workflow.

  3. In the Use workflow from section, select the main branch and then select Run workflow.

    Screenshot showing selecting run workflow.

  4. Monitor the workflow progress until it has completed successfully.

    Screenshot monitoring the progress of the run of the workflow.

  5. Select Code in the navigation and then select branches.

    Screenshot showing the Code option, the number of branches, and selecting the branches list.

  6. You should see the branch that was created by the GitHub Action implementation. Currently, this branch is not merged with your main branch. Select New pull request to start the merge process.

    Screenshot showing selecting new pull request for the branch that was recently created.

  7. In the comments area, enter Initial version of connector.

  8. Select the Create pull request option.

  9. At this point, someone would typically review and merge, but because only you're doing the exercise, you should approve the pull request yourself.

  10. Expand Merge pull request and then select Squash and merge.

    Screenshot showing selecting the merge request.

  11. Select Squash and merge and then select Confirm squash and merge.

    Your branch with your changes has now been merged.

  12. Select Code and then select solutions/ContosoInvoiciningALM. This folder contains the solution files that were created. You can browse the content of this folder to determine what was extracted from the solution and stored as individual files.

    Screenshot looking at the contents of the repository after the merge.

Task 5: Change and record connector definitions

To change and record connector definitions, follow these steps:

  1. Go to Power Apps maker portal and make sure that you are in the correct environment.

  2. Select Solutions and then select the Contoso Invoicing - ALM solution.

  3. Select the ellipsis (...) next to the custom connector component and then select Edit.

    Screenshot showing editing the connector to make a change.

  4. Change Icon background color to #0066ff and then select Update connector.

    Screenshot showing selecting update connector after changing the color.

  5. Repeat steps 1-12 of Task 4 to run the workflow, create a new pull request, and merge the code into the main branch.

  6. Select Code in the navigation then select the pull request name to open the details.

    Screenshot from the pull request.

  7. Verify the recorded change in icon color from #007ee5 to #0066ff.

    Screenshot showing the change of the icon color in the difference.

Note

Other automatic changes could be applied when you save the connector, for example, icon format might change from JPEG to PNG.

You now have an automated process to export and record your custom connector changes in a source control system.