diff --git a/.github/workflows/workflow-markdown-check.yml b/.github/workflows/workflow-markdown-check.yml index e9d248c..4e1d3e3 100644 --- a/.github/workflows/workflow-markdown-check.yml +++ b/.github/workflows/workflow-markdown-check.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@master + uses: actions/checkout@v4 - name: Validating links uses: gaurav-nelson/github-action-markdown-link-check@v1 diff --git a/.github/workflows/workflow-repo-standards-validation.yml b/.github/workflows/workflow-repo-standards-validation.yml index 5412f05..f3c1987 100644 --- a/.github/workflows/workflow-repo-standards-validation.yml +++ b/.github/workflows/workflow-repo-standards-validation.yml @@ -80,15 +80,24 @@ jobs: with: script: | const { owner, repo } = context.repo; + let refBranchNumber; + + if (context.eventName === 'pull_request') { + refBranchNumber = context.payload.pull_request.head.ref; + } else { + refBranchNumber = process.env['GITHUB_REF'].replace('refs/heads/', ''); + } + try { await github.rest.repos.getContent({ owner, repo, - path: 'README.md' + path: `README.md`, + ref: refBranchNumber }); } catch (error) { if (error.status === 404) { - core.setFailed("The repository does not have a README.md file, please add one."); + core.setFailed(`The ${refBranchNumber} branch does not have a README.md file, please add one.`); } else { core.setFailed(`An error occurred while checking for README: ${error.message}`); } @@ -100,21 +109,31 @@ jobs: with: script: | const { owner, repo } = context.repo; + let refBranchNumber; + + if (context.eventName === 'pull_request') { + refBranchNumber = context.payload.pull_request.head.ref; + } else { + refBranchNumber = process.env['GITHUB_REF'].replace('refs/heads/', ''); + } + try { await github.rest.repos.getContent({ owner, repo, - path: 'TESTING.md' + path: `TESTING.md`, + ref: refBranchNumber }); } catch (error) { if (error.status === 404) { - core.setFailed("The repository does not have a TESTING.md file, please add one."); + core.setFailed(`The ${refBranchNumber} branch does not have a TESTING.md file, please add one.`); } else { core.setFailed(`An error occurred while checking for TESTING.md: ${error.message}`); } } if: always() # Run step even if previous steps fail. + - name: Check if all files end in newline uses: fernandrone/linelint@master id: linelint