Skip to content

Commit

Permalink
issue #71: Fixing the markdown check and repo standard workflow (#72)
Browse files Browse the repository at this point in the history
* isse #71: changed secrets for branch protection inside repo standard

* issue #71: changed GITHUB_TOKEN to the previous one

* issue #71: fixed repo-standards and markdown check

* issue #71: fixed repo-standard workflow by changing branch to ref

* issue #71: fixed repo standards workflow

* issue #71: fixed typo

* issue #71: code formatting
  • Loading branch information
ThomasCardin authored Jan 25, 2024
1 parent 2752867 commit 2f5997d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/workflow-markdown-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 23 additions & 4 deletions .github/workflows/workflow-repo-standards-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
Expand All @@ -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
Expand Down

0 comments on commit 2f5997d

Please sign in to comment.