Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Upgrade Workflows/Actions #27

Merged
merged 26 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/HTML.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: HTML Prereq
on:
pull_request:
types: [opened, synchronize]

jobs:
check-html:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Check modified HTML files
id: check
run: |
echo "Checking modified HTML files..."
git diff --name-only HEAD^ | grep '\.html$' | while read html_file; do
echo "Checking $html_file"
missing_lines=()
grep -q '<link rel="stylesheet" type="text/css" href="style.css">' "$html_file" || missing_lines+=('<link rel="stylesheet" type="text/css" href="style.css">')
grep -q '<center>.*</center>' "$html_file" || missing_lines+=('<center> and </center> tag')
grep -q '<a href="/">←Back</a>' "$html_file" || missing_lines+=('<a href="/">←Back</a>')
grep -q '<p id="udate" style="color:lightgrey; font-style:italic;">Updated: </p>' "$html_file" || missing_lines+=('<p id="udate" style="color:lightgrey; font-style:italic;">Updated: </p>')
grep -q 'document.getElementById("udate").innerHTML = document.getElementById("udate").innerHTML + document.lastModified;' "$html_file" || missing_lines+=('document.getElementById("udate").innerHTML = document.getElementById("udate").innerHTML + document.lastModified;')
if [ ${#missing_lines[@]} -ne 0 ]; then
echo "::set-output name=review_status::REQUEST_CHANGES"
echo "::set-output name=review_body::Failing review for $html_file due to missing lines: ${missing_lines[@]}"
exit 0
fi
done
echo "::set-output name=review_status::COMMENT"
echo "::set-output name=review_body::All required lines are present in the modified HTML files."

- name: Create review
uses: octokit/request-action@v2.x
with:
route: POST /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews
review_event: ${{ steps.check.outputs.review_status }}
body: ${{ steps.check.outputs.review_body }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45 changes: 45 additions & 0 deletions .github/workflows/LGTM.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: LGTM Check
on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
check-comments:
runs-on: ubuntu-latest
steps:
- name: Check for LGTM comment
uses: actions/github-script@v5
with:
script: |
const issue_number = context.issue.number;
const owner = context.repo.owner;
const repo = context.repo.repo;

const comments = await github.rest.issues.listComments({
issue_number: issue_number,
owner: owner,
repo: repo
});

for (const comment of comments.data) {
if (comment.body.includes('LGTM')) {
console.log('LGTM comment found!');
await github.rest.pulls.createReview({
owner: owner,
repo: repo,
pull_number: issue_number,
event: 'APPROVE',
body: 'LGTM comment found, approving!'
});
return;
}
}

await github.rest.pulls.createReview({
owner: owner,
repo: repo,
pull_number: issue_number,
event: 'REQUEST_CHANGES',
body: 'No LGTM comment found, please add one.'
});
throw new Error('No LGTM comment found!');
55 changes: 0 additions & 55 deletions .github/workflows/checkmarx-one.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/label.yml

This file was deleted.

Loading