diff --git a/.github/workflows/validate-sample.yml b/.github/workflows/validate-sample.yml index 9a106d34..0934ddbd 100644 --- a/.github/workflows/validate-sample.yml +++ b/.github/workflows/validate-sample.yml @@ -1,4 +1,4 @@ -name: Sample.json validation +name: External validation on: pull_request: @@ -8,39 +8,11 @@ on: jobs: validate: runs-on: ubuntu-latest - outputs: - response: ${{ steps.fetch.outputs.response }} + permissions: + pull-requests: write + issues: write steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Fetch - if: ${{ hashFiles('**/samples.json') != '' }} - id: fetch - run: | - response=$(curl -X POST -H "Content-Type: application/json" -d @assets/samples.json https://m365-galleries.azurewebsites.net/Samples/validateSample); echo "response=$response" >> $GITHUB_OUTPUT - if [[ $(echo "$response" | jq -r '.isValid') == "true" ]]; then - echo "Validation successful! Proceeding with the pull request." - exit 0 - else - echo "Validation failed! Please fix the errors and try again." - exit 1 - fi - failure: - needs: validate - runs-on: ubuntu-latest - if: failure() - steps: - - name: Fail - run: | - echo ${{ needs.validate.outputs.response }} - - uses: actions/github-script@v6 + - name: Validate + uses: pnp/pnp-sample-validation@main with: - script: | - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: JSON.parse(`${{ needs.validate.outputs.response }}`).errors?.map(e => "- " + e).join("\n") - }) - - name: Fail - run: exit 1 \ No newline at end of file + gh-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/samples/ace-chat/assets/sample.json b/samples/ace-chat/assets/sample.json index c2e6cac8..d9ae4e01 100644 --- a/samples/ace-chat/assets/sample.json +++ b/samples/ace-chat/assets/sample.json @@ -8,12 +8,6 @@ "longDescription": [ "This example shows how to build and ACE with multiple card and quick views allowing chat interaction with a Microsoft Teams channel." ], - "creationDateTime": "2021-09-07", - "updateDateTime": "2021-11-18", - "products": [ - "SharePoint", - "Viva" - ], "metadata": [ { "key": "CLIENT-SIDE-DEV", diff --git a/samples/ace-companynews/assets/sample.json b/samples/ace-companynews/assets/sample.json index e1320c13..b4f962e6 100644 --- a/samples/ace-companynews/assets/sample.json +++ b/samples/ace-companynews/assets/sample.json @@ -8,22 +8,6 @@ "longDescription": [ "This example shows an ACE which provides a news article rotator with Quick View for full article details. It shows previous/next buttons, and how to launch the Quick View for the current article. Additionally, you can like/unlike articles directly from the QuickView." ], - "creationDateTime": "2021-09-07", - "updateDateTime": "2021-11-18", - "products": [ - "SharePoint", - "Viva" - ], - "metadata": [ - { - "key": "CLIENT-SIDE-DEV", - "value": "TypeScript" - }, - { - "key": "SPFX-VERSION", - "value": "1.13.0" - } - ], "thumbnails": [ { "type": "image", @@ -60,4 +44,4 @@ } ] } -] \ No newline at end of file +]