Add dotnet upgrade assistant CLI image to rule/dotnet-upgrade-assistant #101
This file contains 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: Validate-Frontmatter | |
on: | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
validate-frontmatter: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
issues: write | |
repository-projects: read | |
pull-requests: write | |
steps: | |
# Step 1: Check out the source code of the pull request. | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
# Step 2: Set up the Node.js environment. | |
- uses: actions/setup-node@v3 | |
# Step 3: Get the list of changed files in the PR | |
- name: Get changed files | |
id: get_changed | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
echo "changed=$(git diff --name-only $(git merge-base origin/main HEAD) HEAD)" | paste -sd "," - >> $GITHUB_ENV | |
# Step 4: Check Markdown files for valid frontmatter | |
- name: Check for Markdown files | |
uses: mathiasvr/command-output@v1 | |
id: check_markdown | |
with: | |
run: | | |
cd scripts/frontmatter-validator | |
npm install --silent | |
node frontmatter-validator.js '${{ env.changed }}' | |
# Step 5: Comment on the PR if the previous step failed | |
- name: Comment on PR | |
if: failure() | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message: | | |
${{ steps.check_markdown.outputs.stdout }} | |
Please fix the Frontmatter in your Markdown files. | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
repo-token-user-login: "github-actions[bot]" | |
allow-repeats: true |