Skip to content

Commit b77f8f0

Browse files
committed
add .github to do code scan
1 parent aa379d5 commit b77f8f0

File tree

6 files changed

+427
-0
lines changed

6 files changed

+427
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "\U0001F680 New User Story"
2+
description: "I am initiating a new user story"
3+
title: '[User Story]'
4+
labels: ["user story"]
5+
body:
6+
- type: dropdown
7+
id: user
8+
attributes:
9+
label: As a
10+
description: Who will be use this feature
11+
options:
12+
- "Contributor: the developer of the repo i.e. CASE CSE"
13+
- "OxM: board vendor"
14+
- "Developer: consumer that purchase a board and want to proceed with development"
15+
multiple: true
16+
validations:
17+
required: true
18+
19+
- type: textarea
20+
attributes:
21+
label: I want to
22+
description: Describe what does the persona wants to accomplish
23+
placeholder: define my own code pair
24+
validations:
25+
required: true
26+
27+
- type: textarea
28+
attributes:
29+
label: So that
30+
description: Describe why the persona needs this feature
31+
placeholder: the model can be fine tuned with my own instructions
32+
validations:
33+
required: true
34+
35+
- type: textarea
36+
attributes:
37+
label: User flow
38+
description: Describe the step that the persona takes to use this feature
39+
- type: textarea
40+
attributes:
41+
label: Additional Context
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "Feature/Enhancement Suggestion"
2+
description: "I am suggesting new features or enhancements"
3+
title: "[Suggestion]"
4+
labels:
5+
- "enhancement"
6+
- "triage"
7+
body:
8+
- type: dropdown
9+
id: user
10+
attributes:
11+
label: Target User
12+
description: Who will be use this feature
13+
options:
14+
- "Contributor: the developer of the repo i.e. CASE CSE"
15+
- "OxM: board vendor"
16+
- "Developer: consumer that purchase a board and want to proceed with development"
17+
multiple: true
18+
validations:
19+
required: true
20+
- type: textarea
21+
attributes:
22+
label: Description
23+
description: Provide a clear and concise description of the new feature or enhancement you are suggesting.
24+
placeholder: Please describe the suggested feature or enhancement.
25+
- type: textarea
26+
attributes:
27+
label: Justification
28+
description: Describe why this enhancement is needed
29+
placeholder: Please list the benefits
30+
- type: textarea
31+
id: current_behavior
32+
attributes:
33+
label: Current Behavior
34+
description: Describe the current behavior or limitations that this suggestion aims to address.
35+
placeholder: Please describe the current behavior or limitations.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: "Bug Report"
2+
description: "I am reporting a bug"
3+
title: "[Bug]"
4+
labels:
5+
- "bug"
6+
- "triage"
7+
body:
8+
- type: textarea
9+
attributes:
10+
label: Current Behaviour
11+
description: Describe what is currently happening
12+
validations:
13+
required: true
14+
- type: textarea
15+
attributes:
16+
label: Expected Behaviour
17+
description: Describe what you expected to happen
18+
validations:
19+
required: true
20+
- type: textarea
21+
id: possible-solution
22+
attributes:
23+
label: Possible Solution
24+
description: Suggest a possible solution.
25+
validations:
26+
required: false
27+
- type: textarea
28+
id: steps-to-reproduce
29+
attributes:
30+
label: Steps to Reproduce
31+
description: Provide detailed steps to reproduce the issue.
32+
validations:
33+
required: true
34+
- type: textarea
35+
id: context
36+
attributes:
37+
label: Context (Environment)
38+
description: Provide any relevant information about your environment.
39+
validations:
40+
required: false
41+
- type: textarea
42+
id: detailed-description
43+
attributes:
44+
label: Detailed Description
45+
description: Provide a more detailed description of the issue.
46+
validations:
47+
required: true
48+
- type: textarea
49+
id: possible-implementation
50+
attributes:
51+
label: Possible Implementation
52+
description: Suggest a possible implementation.
53+
validations:
54+
required: false

.github/pull_request_template.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
**IMPORTANT: Please do not create a Pull Request without creating an issue first.**
2+
3+
*Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.*
4+
5+
Please provide enough information so that others can review your pull request:
6+
7+
**Closing issues**
8+
9+
Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes (if such).

.github/workflows/auto_sync.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Auto sync to public devkit repo when there is push to main branch
2+
3+
name: 'Auto_Sync'
4+
5+
on:
6+
workflow_run:
7+
workflows: [Scan]
8+
types:
9+
- completed
10+
branches: [main]
11+
12+
jobs:
13+
sync-repo:
14+
if: ${{ github.event.workflow_run.event == 'push' }}
15+
runs-on: self-hosted
16+
17+
steps:
18+
- name: Checkout source repository
19+
uses: actions/[email protected]
20+
with:
21+
fetch-depth: 2
22+
23+
- name: Sync files to temporary directory
24+
run: |
25+
mkdir temp_repo
26+
rsync -av --exclude='.github' ./* temp_repo/
27+
28+
- name: Set up Git credential
29+
run: |
30+
git config --global user.name 'gooishin'
31+
git config --global user.email '[email protected]'
32+
33+
- name: Checkout public repository
34+
uses: actions/checkout@v4
35+
with:
36+
repository: 'intel/edge-developer-kit-reference-scripts'
37+
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
38+
path: 'public_repo'
39+
40+
- name: Get last commit message
41+
id: get_commit_message
42+
run: |
43+
commit_message=$(git log -1 --pretty=%B | tr -d '\n')
44+
if [ -z "$commit_message" ]; then
45+
echo "Commit message is empty or only whitespace."
46+
else
47+
echo "message=$commit_message" >> $GITHUB_ENV
48+
echo "The last commit message is $commit_message"
49+
fi
50+
51+
- name: Create branch at destination repo and delete the branch contents
52+
run: |
53+
cd public_repo
54+
git checkout -b update-branch
55+
git branch --set-upstream-to=origin/main
56+
git rm -r *
57+
58+
- name: Copy changes to public repository
59+
run: |
60+
cd public_repo
61+
git checkout update-branch
62+
rsync -av --exclude='.git' --exclude='.github' --exclude='temp_repo' ../temp_repo/ .
63+
git add --all
64+
git commit -m "${{ env.message }}" || echo "No changes to commit"
65+
66+
- name: Push to destination repository
67+
run: |
68+
cd public_repo
69+
git checkout update-branch
70+
git add .
71+
git commit -m "${{ env.message }}" || echo "No changes to commit"
72+
git push origin update-branch
73+
74+
- name: Clean up temporary directory
75+
if: always()
76+
run: |
77+
rm -rf temp_repo public_repo
78+
79+
- name: Create pull request
80+
uses: actions/github-script@v6
81+
with:
82+
github-token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
83+
script: |
84+
const { data: pullRequests } = await github.rest.pulls.list({
85+
owner: 'intel',
86+
repo: 'edge-developer-kit-reference-scripts',
87+
state: 'open',
88+
head: 'intel:update-branch',
89+
base: 'main'
90+
});
91+
92+
if (pullRequests.length === 0) {
93+
await github.rest.pulls.create({
94+
owner: 'intel',
95+
repo: 'edge-developer-kit-reference-scripts',
96+
title: '${{ env.message }}',
97+
head: 'update-branch',
98+
base: 'main',
99+
body: '${{ env.message }}'
100+
});
101+
} else {
102+
console.log('A pull request already exists. Please go to public devkit repo and merge PR first, then re-run this job.', pullRequests[0].html_url);
103+
}

0 commit comments

Comments
 (0)