Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Validation 001 #40

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 7 additions & 35 deletions .github/workflows/validate-sample.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Sample.json validation
name: External validation

on:
pull_request:
Expand All @@ -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
gh-token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 0 additions & 6 deletions samples/ace-chat/assets/sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 1 addition & 17 deletions samples/ace-companynews/assets/sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -60,4 +44,4 @@
}
]
}
]
]
Loading