Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasc-ubc committed Feb 17, 2025
1 parent a9287e5 commit f47dea2
Show file tree
Hide file tree
Showing 21 changed files with 1,352 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/Auto Merge PR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Auto Merge PR

on:
pull_request_target:
types:
- opened
- synchronize
- reopened

permissions:
pull-requests: write
contents: write

jobs:
auto-merge:
runs-on: ubuntu-latest

steps:
- name: Auto-approve PR
uses: hmarr/auto-approve-action@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Enable Auto-Merge
uses: peter-evans/enable-pull-request-automerge@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
pull-request-number: ${{ github.event.pull_request.number }}
merge-method: merge # Options: merge, squash, rebase

- name: Merge PR if all checks pass
uses: pascalgn/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MERGE_LABELS: ""
MERGE_DELETE_BRANCH: "false"
18 changes: 18 additions & 0 deletions .github/workflows/AutomaticApprove.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Automatic Approve
on:
schedule:
- cron: "*/5 * * * *"

jobs:
automatic-approve:
name: Automatic Approve
if: github.repository_owner == 'SiEPIC'
#if: >-
#github.event.pull_request.user.login != 'SiEPIC' && repository_dispatch.organization
runs-on: ubuntu-latest
steps:
- name: Automatic Approve
uses: mheap/automatic-approve-action@v1
with:
token: ${{ secrets.PAT }}
workflows: "run-verification.yml,case_sensitivity.yml,check_gds_files.yml"
18 changes: 18 additions & 0 deletions .github/workflows/Comment_on_PR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Comment on PR

on: pull_request_target

jobs:
Comment_on_PR:
runs-on: ubuntu-latest
name: Leave a comment on the Pull Request
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Comment PR
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Thank you for your pull request! :wave:
78 changes: 78 additions & 0 deletions .github/workflows/PullRequest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: PullRequest
on:
# pull_request:
# branches:
# - '**'
pull_request_target:
branches:
- '**'


jobs:
welcome:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
// Get a list of all issues created by the PR opener
// See: https://octokit.github.io/rest.js/#pagination
const creator = context.payload.sender.login
const opts = github.rest.issues.listForRepo.endpoint.merge({
...context.issue,
creator,
state: 'all'
})
const issues = await github.paginate(opts)
const PR_NUMBER = context.payload.pull_request.number;
const REPO_OWNER = context.repo.owner;
const REPO_NAME = context.repo.repo;
// Check if the 'greeted' label is already present
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
owner: REPO_OWNER,
repo: REPO_NAME,
issue_number: PR_NUMBER,
});
const alreadyGreeted = labels.some(label => label.name === 'greeted');
// Don't post the message more than once.
if (alreadyGreeted) {
console.log(`PR #${PR_NUMBER} has already been greeted.`);
return
}
for (const issue of issues) {
if (issue.number === context.issue.number) {
continue
}
if (issue.pull_request) {
console.log(`Creator #${creator} has already been greeted.`);
return // Creator is already a contributor.
}
}
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `**Welcome**, new contributor!
Thank you for uploading your design.
If you have not already checked it, please run the SiEPIC Functional Verification in KLayout, using the menu SiEPIC-Verification-Functional Layout Check (V).
You may continue making updates to your design, or even contributing additonal designs (using a separate file name), until the tape-out deadline.
`
})
// Add the 'greeted' label to mark this PR as greeted
await github.rest.issues.addLabels({
owner: REPO_OWNER,
repo: REPO_NAME,
issue_number: PR_NUMBER,
labels: ['greeted'],
});
console.log(`Welcome message posted for PR #${PR_NUMBER}`);
28 changes: 28 additions & 0 deletions .github/workflows/case_sensitivity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Case Sensitivity check

on:
push:
paths:
- 'submissions/**.gds'
- 'submissions/**.GDS'
- 'submissions/**.oas'
- 'submissions/**.OAS'
branches:
- '**'
pull_request:
branches:
- '**'

jobs:
case-sensitivity_job:
runs-on: ubuntu-latest
name: check-file-case-sensitivity
steps:
# Checkout the source code so we have some files to look at.
- uses: actions/checkout@v2
with:
fetch-depth: 0
# Run the case checker action
- name: Check Case Sensitivity
uses: credfeto/[email protected]

76 changes: 76 additions & 0 deletions .github/workflows/check_gds_files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Check GDS and OAS File Submissions

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
check_files:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Fetch all branches
run: git fetch --all

- name: Get list of changed files
id: changed_files
run: |
echo "Fetching changed files..."
FILES=$(git diff --name-only --diff-filter=ACM origin/${{ github.base_ref }}...HEAD)
if [[ -z "$FILES" ]]; then
echo "No changed files detected."
exit 0 # Exits early if no files were changed
fi
echo "Files detected:"
echo "$FILES"
# Store it properly in environment variable
{
echo "files<<EOF"
echo "$FILES"
echo "EOF"
} >> $GITHUB_ENV
- name: Debug changed files
run: |
echo "Changed files:"
echo "${{ env.files }}"
- name: Debug File Paths
run: |
mapfile -t file_array <<< "${{ env.files }}"
for file in "${file_array[@]}"; do
echo "Checking file: '$file'"
done
shell: bash

- name: Check GDS and OAS file locations and names
run: |
mapfile -t file_array <<< "${{ env.files }}"
for file in "${file_array[@]}"; do
trimmed_file=$(echo "$file" | tr -d '[:space:]') # Trim spaces/newlines

if [[ "$trimmed_file" == *.gds || "$trimmed_file" == *.oas ]]; then
if [[ "$trimmed_file" != submissions/* ]]; then
echo "Error: File '$trimmed_file' is not in the 'submissions' folder."
exit 1
fi
if [[ "$trimmed_file" == *" "* ]]; then
echo "Error: File '$trimmed_file' contains spaces in the filename."
exit 1
fi
fi
done
shell: bash

- name: Success message
if: success()
run: echo "All GDS and OAS files are correctly placed in the submissions folder and contain no spaces in their filenames."
14 changes: 14 additions & 0 deletions .github/workflows/dummy-status.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Dummy Status Check

on:
pull_request:
push:
branches:
- main # Ensures it runs on pushes to main

jobs:
dummy-check:
runs-on: ubuntu-latest
steps:
- name: Dummy Status Check
run: echo "Passing status check"
Loading

0 comments on commit f47dea2

Please sign in to comment.