Moves Job scope to inner lambda #8245
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 Pull Request | |
on: | |
pull_request_target: | |
branches: | |
- main | |
types: | |
- labeled | |
- unlabeled | |
- opened | |
- reopened | |
- synchronize | |
- edited | |
env: | |
LABELS: ${{ join( github.event.pull_request.labels.*.name, ' ' ) }} | |
TITLE: ${{ github.event.pull_request.title }} | |
NO_MILESTONE: ${{ github.event.pull_request.milestone == null }} | |
AUTHOR: ${{ github.event.pull_request.user.login}} | |
jobs: | |
js-title: | |
name: Check Metadata | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v4 # Uploads repository content to the runner | |
with: | |
repository: "microsoft/fhir-server" | |
- uses: actions/labeler@v5 | |
- uses: actions/github-script@v7 | |
with: | |
script: | | |
var errors = ""; | |
const title = "${{env.TITLE}}"; | |
const body = context.payload.pull_request.body; | |
const labels = "${{env.LABELS}}"; | |
const author = "${{env.AUTHOR}}"; | |
const excludeAuthors = ["dependabot[bot]"]; | |
if(title.toLowerCase().includes('personal') || (title.length > 65)) { | |
errors += '- Title of the PR to be succinct and less than 65 characters. \n'; | |
} | |
if(body.toLowerCase().includes('ab#') == false && | |
body.toLowerCase().includes('/_workitems') == false && | |
excludeAuthors.includes(author) == false && | |
labels.includes("External Author") == false) { | |
errors += '- FHIR Team: A DevOps workitem is required. Use AB#123 syntax or link to DevOps item. \n'; | |
} | |
if(${{env.NO_MILESTONE}}) { | |
errors += '- Add a milestone to the PR for the sprint that it is merged (i.e. add S47). \n'; | |
} | |
if(labels.includes("Build") == false && | |
labels.includes("Documentation") == false && | |
labels.includes("Bug") == false && | |
labels.includes("Dependencies") == false && | |
labels.includes("Enhancement") == false && | |
labels.includes("New Feature") == false && | |
labels.includes("New-Feature") == false) { | |
errors += '- Tag the PR with the type of update: **Bug**, **Build**, **Dependencies**, **Enhancement**, **New Feature**, **New-Feature** or **Documentation**. \n'; | |
} | |
if(labels.includes("Open source") == false && | |
labels.includes("Azure API for FHIR") == false && | |
labels.includes("Azure Healthcare APIs") == false && | |
labels.includes("Dependencies") == false && | |
labels.includes("Build") == false && | |
labels.includes("Documentation") == false) { | |
errors += '- Tag the PR with **Open source only**, **Azure API for FHIR** (CosmosDB or common code) or **Azure Healthcare APIs** (SQL or common code) to specify where this change is intended to be released. \n'; | |
} | |
if(labels.includes("SQL Scripts") == true && | |
labels.includes("Schema Version backward incompatible") == false && | |
labels.includes("Schema Version unchanged") == false && | |
labels.includes("Schema Version backward compatible") == false) { | |
errors += '- Tag the PR with the type of update: **Schema Version backward incompatible**, **Schema Version backward compatible**. \n'; | |
} | |
if(errors != "") { | |
core.setFailed(errors) | |
} |