Skip to content

Latest commit

 

History

History
215 lines (146 loc) · 13.3 KB

CONTRIBUTING.md

File metadata and controls

215 lines (146 loc) · 13.3 KB

Contribution Guidance

If you'd like to contribute to this repository, please read the following guidelines. Contributors are more than welcome to share their learnings with others in this centralized location.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Remember that this repository is maintained by community members who volunteer their time to help. Be courteous and patient.

Question or Problem?

Please do not open GitHub issues for general support questions as the GitHub list should be used for feature requests and bug reports. This way we can more easily track actual issues or bugs from the code and keep the general discussion separate from the actual code.

For product and how-to questions, use the Power Platform Community forums, our primary discussion space. Use this repository's issue tracker for reproducible sample bugs and repository improvements.

Community calls and demos

Everyone is welcome to join the weekly community calls for Copilot, Microsoft 365, and Power Platform updates. If you would like to share your learnings or gather community input, sign up for a demo.

Watch call recordings and demos on Microsoft Community Learning, and find product videos and tutorials on Microsoft Power Platform.

Typos, Issues, Bugs and contributions

Whenever you are submitting any changes to the community sample repositories, please follow these recommendations.

  • Always fork the repository to your own account before making your modifications
  • Do not combine multiple changes to one pull request. For example, submit any samples and documentation updates using separate PRs
  • If your pull request shows merge conflicts, make sure to update your local main to be a mirror of what's in the main repo before making your modifications
  • If you are submitting multiple samples, please create a specific PR for each of them
  • If you are submitting typo or documentation fix, you can combine modifications to single PR where suitable

Why

To make your app reusable, so that more people can benefit from it, we want to share the source code files. To be able to get the source files, you will need to use the Power Platform CLI to extract all files from the solution.

By using solutions, you have the ability to add multiple components to your solution. You don't have to only have a Power App, but you can also combine it with a dataverse table or a cloud flow.

Prerequisites

To unpack the source code for your solution, you will need to use the Power Platform CLI. The easiest way install the Power Platform CLI, is by installing the Power Platform Tools for Visual Studio Code. This means you will also have to install Visual Studio Code.

Sample Naming and Structure Guidelines

When you are submitting a new sample, it has to follow up below guidelines

  • Create the sample in its own folder under samples/ and include an assets/sample.json metadata file based on the provided metadata template. Update every placeholder, including the sample URLs, thumbnail, products, categories, and author information.
  • Include a README.md based on the provided template. The filename must be exactly README.md because it is used to publish the sample.
    • Include at least one static, high-resolution screenshot of the configured sample. Store preview images in the sample's assets/ folder.

    • Keep the tracker image as the final line of the README:

      <img src="https://m365-visitor-stats.azurewebsites.net/powerplatform-samples/{sample-path}" />

      Replace {sample-path} with the repository-relative path to the sample folder. For example, samples/YOUR-SOLUTION-NAME produces https://m365-visitor-stats.azurewebsites.net/powerplatform-samples/samples/YOUR-SOLUTION-NAME.

  • If you find an existing sample which is similar to yours, please extend the existing one rather than submitting a new similar sample
    • For example, if you have an new Power Fx sample, please add a page to the existing solution, rather than introducing a completely new solution
    • When you update existing samples, please update also README.md file accordingly with information on provided changes and with your author details
  • When submitting a new sample solution, please name the sample solution folder accordingly
  • Do not use period/dot in the folder name of the provided sample
  • All folders should be in lower case

Gallery metadata and local validation

The local sample gallery reads every sample's assets/sample.json and README.md. Missing or invalid metadata fails generation rather than silently excluding a sample.

  • Use the exact filename assets/sample.json, containing one sample record. Use the actual, case-sensitive sample folder in source, download, thumbnail, and tracker URLs.
  • Keep screenshots in that sample's assets folder. The first image thumbnail by ascending order becomes the card preview; additional images appear on its detail page. Give every image useful alternative text.
  • Use YYYY-MM-DD dates for new records. Existing ISO timestamps remain supported. Do not change historical dates simply to make a sample appear new.
  • Use GitHub account names, not profile URLs or display names, in gitHubAccount. Contributor display names belong in name.
  • Label new agent samples Copilot Studio. Historical Power Virtual Agents labels remain searchable and are displayed under Copilot Studio. Power Fx and Custom Connectors are also discoverable.
  • Keep product, category, and licensing facts accurate. Do not assume that a broad Power Apps category means a canvas app or that a sample has no premium requirements.
  • An omitted download URL is supported: the gallery derives the standard partial-download link from the verified current source folder.
  • Retain the single sample-view image at the end of the README. The website removes that image from rendered documentation and uses one page-level image with the same sample key, avoiding duplicate counts.

Use Node.js 22.12 or later and run the following from the repository root:

cd site
npm ci
npm run validate:readme-trackers
npm test
npm run check
npm run build

For website interaction changes, install the test browser once with npx playwright install chromium and run npm run test:e2e. Use npm run dev to inspect previews. Localhost visits and automated browser tests do not send production visitor events.

The community contributor badge is highlighted in the gallery. See community recognition for the community's recognition guidance.

Clone the solution

  • Open up Visual Studio Code

  • Open a terminal by going to Terminal > New Terminal or by using ctrl + backtick

  • Create a new auth profile by using the the pac auth create command (Link) or by using the Power Platform Tools pane in Visual Studio Code (that's the Power Apps icon in the activity bar that's on the left of in Visual Studio Code)

  • Make sure that you are connected to the right environment by using the pac org who command. This will show you to which environment you are connected. If you are not connected to the right environment, you can switch by using the pac org select command (link)

  • To clone the solution we need the internal name of the solution. If you don't know it by heart, you can list all the solutions in the environment by using the pac solution list command (link)

  • Cloning can be done by using the pac solution clone command (link), type the following command in the terminal:

    pac solution clone --name InternalSolutionName --outputDirectory sourcecode --processCanvasApps

    Making sure to replace InternalSolutionName to the internal solution name. Be sure to wrap values that have spaces!

    The --processCanvasApps is used to unpack the canvas apps that might be in your solution.

Please note that you will now find all source code files in that new folder. You can open the folder in Visual Studio Code.

Submitting Pull Requests

Here's a high-level process for submitting new samples or updates to existing ones.

  1. Sign the Contributor License Agreement (see below)
  2. Fork this repository pnp/powerplatform-samples to your GitHub account
  3. Create a new branch from the main branch for your fork for the contribution
  4. Include your changes to your branch
  5. Commit your changes using descriptive commit message * These are used to track changes on the repositories for monthly communications
  6. Open a pull request from your fork's branch to the main branch of pnp/powerplatform-samples
  7. Complete the provided pull request template with the requested details

If you feel insecure about that process or are new to GitHub, please consider to attend the Sharing Is Caring sessions from the PnP team in which the Microsoft 365 PnP team provides hands-on guidance for first time contributors.

Before you submit your pull request consider the following guidelines:

  • Search GitHub for an open or closed Pull Request which relates to your submission. You don't want to duplicate effort.

  • Make sure you have a link in your local cloned fork to the pnp/powerplatform-samples

    # check if you have a remote pointing to the Microsoft repo:
    git remote -v
    
    # if you see a pair of remotes (fetch & pull) that point to https://github.com/pnp/powerplatform-samples, you're ok... otherwise you need to add one
    
    # add a new remote named "upstream" and point to the Microsoft repo
    git remote add upstream https://github.com/pnp/powerplatform-samples.git
  • Make your changes in a new git branch:

    git checkout -b YOUR-SOLUTION-NAME main
  • Ensure your fork is updated and not behind the upstream powerplatform-samples repo. Refer to these resources for more information on syncing your repo:

    • GitHub Help: Syncing a Fork

    • Keep Your Forked Git Repo Updated with Changes from the Original Upstream Repo

    • For a quick cheat sheet:

      # assuming you are in the folder of your locally cloned fork....
      git checkout main
      
      # assuming you have a remote named `upstream` pointing official **powerplatform-samples** repo
      git fetch upstream
      
      # update your local main to be a mirror of what's in the main repo
      git pull --rebase upstream main
      
      # switch to your branch where you are working, say "YOUR-SOLUTION-NAME"
      git checkout YOUR-SOLUTION-NAME
      
      # update your branch to update it's fork point to the current tip of main & put your changes on top of it
      git rebase main
  • Push your branch to GitHub:

    git push origin YOUR-SOLUTION-NAME

Merging your Existing GitHub Projects with this Repository

If the sample you wish to contribute is stored in your own GitHub repository, you can use the following steps to merge it with this repository:

  • Fork the powerplatform-samples repository from GitHub

  • Create a local git repository

    md powerplatform-samples
    cd powerplatform-samples
    git init
  • Pull your forked copy of powerplatform-samples into your local repository

    git remote add origin https://github.com/yourgitaccount/powerplatform-samples.git
    git pull origin main
  • Pull your other project from GitHub into the samples folder of your local copy of powerplatform-samples

    git subtree add --prefix=samples/YOUR-SOLUTION-NAME https://github.com/yourgitaccount/YOUR-SOLUTION-NAME.git main
  • Push the changes up to your forked repository

    git push origin main

Signing the CLA

Before we can accept your pull requests you will be asked to sign electronically Contributor License Agreement (CLA), which is a pre-requisite for any contributions all PnP repositories. This will be one-time process, so for any future contributions you will not be asked to re-sign anything. After the CLA has been signed, our PnP core team members will have a look at your submission for a final verification of the submission. Please do not delete your development branch until the submission has been closed.

You can find Microsoft CLA from the following address - https://cla.microsoft.com.

Thank you for your contribution.

Sharing is caring.