PETOSS 536 | Open API Pipeline for PR creation #3
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: Open API PR check | |
on: | |
pull_request: | |
paths: | |
- '**' | |
jobs: | |
pr-health-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install yaml lint | |
run: pip install yamllint | |
- name: Get list of changed files | |
id: changed_files | |
run: | | |
git fetch origin ${{github.base_ref}} --depth=1 | |
git diff --name-only origin/${{github.base_ref}}...HEAD > changed_files.txt | |
grep -E '\.ya?ml$' changed_files.txt > yaml_files.txt || true | |
- name: Run yaml lint on changed files | |
run: | | |
if [ -s yaml_files.txt ]; then | |
echo "Linting the following yaml files:" | |
cat yaml_files.txt | |
xargs yamllint < yaml_files.txt | |
else | |
echo 'no yaml files changed' | |
fi | |
# - name: Checkout codegen repo | |
# uses: actions/checkout@v4 | |
# with: | |
# repository: xero-internal/xeroapi-sdk-codegen | |
# path: xeroapi-sdk-codegen | |
# - name: Install octokit dependencies | |
# run: npm i | |
# working-directory: xeroapi-sdk-codegen/.github/octokit | |
# - name: Get github app access token | |
# id: get_access_token | |
# env: | |
# GITHUB_APP_ID: ${{ secrets.XERO_GITHUB_APP_ID }} | |
# GITHUB_APP_PRIVATE_KEY: ${{ secrets.XERO_GITHUB_APPLICATION_KEY }} | |
# uses: actions/github-script@v7 | |
# with: | |
# result-encoding: string | |
# script: | | |
# const { getAccessToken } = await import('${{ github.workspace }}/xeroapi-sdk-codegen/.github/octokit/index.js') | |
# const token = await getAccessToken() | |
# return token | |
# - name: Checkout xero-node repo | |
# uses: actions/checkout@v4 | |
# with: | |
# repository: XeroAPI/xero-node | |
# path: xero-node | |
# token: ${{steps.get_access_token.outputs.result}} |