Skip to content

Commit 3f2e56c

Browse files
authored
Merge pull request #288 from dev-hato/develop
v2.0.2 リリース 🍣
2 parents 6c3b962 + 493a224 commit 3f2e56c

33 files changed

Lines changed: 5206 additions & 241 deletions

.github/dependabot.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,20 @@ updates:
33
- package-ecosystem: pip
44
directory: "/"
55
schedule:
6-
interval: monthly
6+
interval: "monthly"
7+
- package-ecosystem: docker
8+
directory: "/"
9+
schedule:
10+
interval: "monthly"
11+
- package-ecosystem: docker
12+
directory: "/setup/pgsql"
13+
schedule:
14+
interval: "monthly"
15+
- package-ecosystem: github-actions
16+
directory: "/"
17+
schedule:
18+
interval: "monthly"
19+
- package-ecosystem: npm
20+
directory: "/"
21+
schedule:
22+
interval: "monthly"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [develop, master]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [develop, master]
9+
schedule:
10+
- cron: '0 21 * * 0'
11+
12+
jobs:
13+
analyze:
14+
name: Analyze
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
# Override automatic language detection by changing the below list
21+
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
22+
language: ['python']
23+
# Learn more...
24+
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v2
29+
with:
30+
# We must fetch at least the immediate parents so that if this is
31+
# a pull request then we can checkout the head.
32+
fetch-depth: 2
33+
34+
# If this run was triggered by a pull request event, then checkout
35+
# the head of the pull request instead of the merge commit.
36+
- run: git checkout HEAD^2
37+
if: ${{ github.event_name == 'pull_request' }}
38+
39+
# Initializes the CodeQL tools for scanning.
40+
- name: Initialize CodeQL
41+
uses: github/codeql-action/init@v1
42+
with:
43+
languages: ${{ matrix.language }}
44+
45+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
46+
# If this step fails, then you should remove it and run the build manually (see below)
47+
- name: Autobuild
48+
uses: github/codeql-action/autobuild@v1
49+
50+
# ℹ️ Command-line programs to run using the OS shell.
51+
# 📚 https://git.io/JvXDl
52+
53+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
54+
# and modify them (or add more) to build your code if your project
55+
# uses a compiled language
56+
57+
#- run: |
58+
# make bootstrap
59+
# make release
60+
61+
- name: Perform CodeQL Analysis
62+
uses: github/codeql-action/analyze@v1
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: pr-check-pipfile
2+
3+
# PipfileかPipfile-lock-*に差分があるPRに反応して起動する
4+
on:
5+
pull_request:
6+
paths:
7+
- "Pipfile*"
8+
9+
env:
10+
WORKON_HOME: /tmp/.venv
11+
12+
jobs:
13+
# PipfileかPipfile-lock-*に差分があれば、Pipfileからlockファイルを作り出す
14+
pr-check-pipfile:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
python-version: [3.8, 3.7]
19+
fail-fast: false
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
with:
24+
# ここでsubmodule持ってくるとdetached headにcommitして死ぬ
25+
# submodule: 'recursive'
26+
fetch-depth: 0
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v2.1.4
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
- name: Install pipenv
32+
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
33+
- name: pipenv lock
34+
run: pipenv lock
35+
- name: pipfile mv
36+
run: mv Pipfile.lock Pipfile.lock-${{ matrix.python-version }}
37+
# 差分があったときは差分を出力する
38+
- name: Show diff
39+
id: diff
40+
run: |
41+
result=`git diff`
42+
echo "::set-output name=result::$result"
43+
# 差分があったときは、コミットを作りpushする
44+
- name: Push
45+
if: github.event.pull_request.head.repo.full_name == github.repository && steps.diff.outputs.result != ''
46+
env:
47+
PYTHON_VERSION: ${{ matrix.python-version }}
48+
run: |
49+
git config user.name "hatohakaraage"
50+
git config user.email "hatohakaraage@example.com"
51+
git add -u
52+
git commit -m "鳩は唐揚げ!(自動で直してあげたよ!)"
53+
git push -f https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:refs/heads/pipfile-${PYTHON_VERSION//\./_}-${{github.event.pull_request.head.ref}}
54+
# pushしたブランチでPRを作る
55+
- name: Create PullRequest
56+
uses: actions/github-script@v3
57+
if: github.event.pull_request.head.repo.full_name == github.repository && steps.diff.outputs.result != ''
58+
env:
59+
PYTHON_VERSION: ${{ matrix.python-version }}
60+
with:
61+
github-token: ${{secrets.GITHUB_TOKEN}}
62+
script: |
63+
const common_params = {
64+
owner: context.repo.owner,
65+
repo: context.repo.repo
66+
}
67+
const pull_params = {
68+
head: "${{github.event.pull_request.head.repo.owner.login}}:pipfile-" + process.env.PYTHON_VERSION.replace('.', '_') + "-${{github.event.pull_request.head.ref}}",
69+
base: "${{github.event.pull_request.head.ref}}",
70+
...common_params
71+
}
72+
const pulls_list_params = {
73+
state: "open",
74+
...pull_params
75+
}
76+
console.log("call pulls.list:")
77+
console.log(pulls_list_params)
78+
github.pulls.list(pulls_list_params).then(list_res => {
79+
if (list_res.data.length === 0) {
80+
const pulls_create_params = {
81+
title: "pipfile (" + process.env.PYTHON_VERSION + ") が更新されたので直してあげたよ!PRをマージしてね! #${{github.event.pull_request.number}}",
82+
body: "鳩の唐揚げおいしい!😋😋😋 #${{github.event.pull_request.number}}",
83+
...pull_params
84+
}
85+
console.log("call pulls.create:")
86+
console.log(pulls_create_params)
87+
github.pulls.create(pulls_create_params).then(create_res => {
88+
const issues_add_assignees_params = {
89+
issue_number: create_res.data.number,
90+
assignees: ["${{github.event.pull_request.user.login}}"],
91+
...common_params
92+
}
93+
console.log("call issues.addAssignees:")
94+
console.log(issues_add_assignees_params)
95+
github.issues.addAssignees(issues_add_assignees_params)
96+
})
97+
}
98+
})
99+
# 既にPipfile修正のPRがある状態で、手動でPipfileを修正した場合、Pipfile修正のPRを閉じる
100+
- name: Close PullRequest
101+
uses: actions/github-script@v3
102+
if: github.event.pull_request.head.repo.full_name == github.repository && steps.diff.outputs.result == ''
103+
env:
104+
PYTHON_VERSION: ${{ matrix.python-version }}
105+
with:
106+
github-token: ${{secrets.GITHUB_TOKEN}}
107+
script: |
108+
const head_name = "pipfile-" + process.env.PYTHON_VERSION.replace('.', '_') + "-${{github.event.pull_request.head.ref}}"
109+
const common_params = {
110+
owner: context.repo.owner,
111+
repo: context.repo.repo
112+
}
113+
const pulls_list_params = {
114+
head: "${{github.event.pull_request.head.repo.owner.login}}:" + head_name,
115+
base: "${{github.event.pull_request.head.ref}}",
116+
state: "open",
117+
...common_params
118+
}
119+
console.log("call pulls.list:")
120+
console.log(pulls_list_params)
121+
github.pulls.list(pulls_list_params).then(res => {
122+
for(const data of res.data){
123+
const pulls_update_params = {
124+
pull_number: data.number,
125+
state: "closed",
126+
...common_params
127+
}
128+
console.log("call pulls.update:")
129+
console.log(pulls_update_params)
130+
github.pulls.update(pulls_update_params).then(res2 => {
131+
const git_deleteRef_params = {
132+
ref: "heads/" + head_name,
133+
...common_params
134+
}
135+
console.log("call git.deleteRef:")
136+
console.log(git_deleteRef_params)
137+
github.git.deleteRef(git_deleteRef_params)
138+
})
139+
}
140+
})
141+
- name: Exit
142+
if: steps.diff.outputs.result != ''
143+
run: exit 1
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: pr-check-yarn
2+
3+
# package.jsonかyarn.lockに差分があるPRに反応して起動する
4+
on:
5+
pull_request:
6+
paths:
7+
- "package.json"
8+
- "yarn.lock"
9+
10+
jobs:
11+
# package.jsonかyarn.lockに差分があれば、package.jsonからyarn.lockを作り出す
12+
pr-check-yarn:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
node-version: [12.x]
17+
fail-fast: false
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
with:
22+
# ここでsubmodule持ってくるとdetached headにcommitして死ぬ
23+
# submodule: 'recursive'
24+
fetch-depth: 0
25+
- name: Set up Node.js ${{ matrix.node-version }}
26+
uses: actions/setup-node@v2.1.2
27+
with:
28+
node-version: ${{ matrix.node-version }}
29+
- name: Install dependencies
30+
run: |
31+
yarn install -D
32+
# 差分があったときは差分を出力する
33+
- name: Show diff
34+
id: diff
35+
run: |
36+
result=`git diff`
37+
echo "::set-output name=result::$result"
38+
# 差分があったときは、コミットを作りpushする
39+
- name: Push
40+
if: github.event.pull_request.head.repo.full_name == github.repository && steps.diff.outputs.result != ''
41+
run: |
42+
git config user.name "hatohakaraage"
43+
git config user.email "hatohakaraage@example.com"
44+
git add -u
45+
git commit -m "鳩は唐揚げ!(自動で直してあげたよ!)"
46+
git push -f https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:refs/heads/yarn-${{github.event.pull_request.head.ref}}
47+
# pushしたブランチでPRを作る
48+
- name: Create PullRequest
49+
uses: actions/github-script@v3
50+
if: github.event.pull_request.head.repo.full_name == github.repository && steps.diff.outputs.result != ''
51+
with:
52+
github-token: ${{secrets.GITHUB_TOKEN}}
53+
script: |
54+
const common_params = {
55+
owner: context.repo.owner,
56+
repo: context.repo.repo
57+
}
58+
const pull_params = {
59+
head: "${{github.event.pull_request.head.repo.owner.login}}:yarn-${{github.event.pull_request.head.ref}}",
60+
base: "${{github.event.pull_request.head.ref}}",
61+
...common_params
62+
}
63+
const pulls_list_params = {
64+
state: "open",
65+
...pull_params
66+
}
67+
console.log("call pulls.list:")
68+
console.log(pulls_list_params)
69+
github.pulls.list(pulls_list_params).then(list_res => {
70+
if (list_res.data.length === 0) {
71+
const pulls_create_params = {
72+
title: "package.jsonやyarn.lockが更新されたので直してあげたよ!PRをマージしてね! #${{github.event.pull_request.number}}",
73+
body: "鳩の唐揚げおいしい!😋😋😋 #${{github.event.pull_request.number}}",
74+
...pull_params
75+
}
76+
console.log("call pulls.create:")
77+
console.log(pulls_create_params)
78+
github.pulls.create(pulls_create_params).then(create_res => {
79+
const issues_add_assignees_params = {
80+
issue_number: create_res.data.number,
81+
assignees: ["${{github.event.pull_request.user.login}}"],
82+
...common_params
83+
}
84+
console.log("call issues.addAssignees:")
85+
console.log(issues_add_assignees_params)
86+
github.issues.addAssignees(issues_add_assignees_params)
87+
})
88+
}
89+
})
90+
# 既にpackage.json, yarn.lock修正のPRがある状態で、手動でpackage.json, yarn.lockを修正した場合、修正のPRを閉じる
91+
- name: Close PullRequest
92+
uses: actions/github-script@v3
93+
if: github.event.pull_request.head.repo.full_name == github.repository && steps.diff.outputs.result == ''
94+
with:
95+
github-token: ${{secrets.GITHUB_TOKEN}}
96+
script: |
97+
const head_name = "yarn-${{github.event.pull_request.head.ref}}"
98+
const common_params = {
99+
owner: context.repo.owner,
100+
repo: context.repo.repo
101+
}
102+
const pulls_list_params = {
103+
head: "${{github.event.pull_request.head.repo.owner.login}}:" + head_name,
104+
base: "${{github.event.pull_request.head.ref}}",
105+
state: "open",
106+
...common_params
107+
}
108+
console.log("call pulls.list:")
109+
console.log(pulls_list_params)
110+
github.pulls.list(pulls_list_params).then(res => {
111+
for(const data of res.data){
112+
const pulls_update_params = {
113+
pull_number: data.number,
114+
state: "closed",
115+
...common_params
116+
}
117+
console.log("call pulls.update:")
118+
console.log(pulls_update_params)
119+
github.pulls.update(pulls_update_params).then(res2 => {
120+
const git_deleteRef_params = {
121+
ref: "heads/" + head_name,
122+
...common_params
123+
}
124+
console.log("call git.deleteRef:")
125+
console.log(git_deleteRef_params)
126+
github.git.deleteRef(git_deleteRef_params)
127+
})
128+
}
129+
})
130+
- name: Exit
131+
if: steps.diff.outputs.result != ''
132+
run: exit 1

0 commit comments

Comments
 (0)