This repository has been archived by the owner on Jan 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
autogen: updated common files in HiromiShikata
- Loading branch information
1 parent
dafc98d
commit 687d509
Showing
5 changed files
with
151 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Lint Commit Messages | ||
on: push | ||
|
||
jobs: | ||
commit-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
|
||
- name: Install commitlint | ||
run: | | ||
npm install --save-dev @commitlint/{config-conventional,cli} | ||
- name: Lint commits | ||
run: | | ||
npx commitlint --from=HEAD~1 --to=HEAD --config ./.github/workflows/configs/commitlint.config.js | ||
check-dontmerge: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Check for DONTMERGE | ||
run: | | ||
result=$(find . \ | ||
-type f \ | ||
! -path './.github/workflows/commit-lint.yml' \ | ||
! -name '*.snap' \ | ||
-exec grep -Hn 'DONTMERGE' {} \;) | ||
if [[ ! -z "$result" ]]; then | ||
echo "$result" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module.exports = { | ||
rules: { | ||
'type-enum': [ | ||
2, | ||
'always', | ||
[ | ||
'build', | ||
'chore', | ||
'ci', | ||
'docs', | ||
'feat', | ||
'fix', | ||
'perf', | ||
'refactor', | ||
'revert', | ||
'style', | ||
'test', | ||
'autogen', | ||
] | ||
], | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,64 @@ | ||
name: Run the Action on each commit | ||
name: Create PR | ||
|
||
on: | ||
push: | ||
branches-ignore: main | ||
branches-ignore: | ||
- main | ||
|
||
jobs: | ||
action-pull-request: | ||
create_and_enable_automerge: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Create pull request | ||
uses: devops-infra/[email protected] | ||
|
||
- name: Set branch name as output | ||
id: branch_name | ||
run: echo "::set-output name=branch::${GITHUB_REF#refs/heads/}" | ||
|
||
- name: Create Pull Request | ||
id: create_pr | ||
uses: repo-sync/pull-request@v2 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
reviewer: HiromiShikata | ||
target_branch: main | ||
github_token: ${{ secrets.GH_TOKEN }} | ||
destination_branch: 'main' | ||
source_branch: '' | ||
pr_title: '${{ steps.branch_name.outputs.branch }}' | ||
pr_body: 'This is an auto-create PR.' | ||
draft: false | ||
|
||
- name: Assign PR to author | ||
if: steps.create_pr.outputs.pr_number | ||
run: | | ||
curl -s -X POST \ | ||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-d '{"assignees":["${{ github.actor }}"]}' \ | ||
"https://api.github.com/repos/${{ github.repository }}/issues/${{ steps.create_pr.outputs.pr_number }}/assignees" | ||
- name: Get PR Node ID | ||
if: steps.create_pr.outputs.pr_number | ||
id: get_pr_id | ||
run: | | ||
PR_DATA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/${{ github.repository }}/pulls/${{ steps.create_pr.outputs.pr_number }}") | ||
PR_ID=$(echo "$PR_DATA" | jq -r '.node_id') | ||
echo "::set-output name=node_id::$PR_ID" | ||
- name: Enable Auto Merge for PR | ||
if: steps.create_pr.outputs.pr_number | ||
run: | | ||
RESPONSE=$(curl -s -X POST \ | ||
-H "Authorization: bearer ${{ secrets.GH_TOKEN }}" \ | ||
-H "Content-Type: application/json" \ | ||
-d '{ | ||
"query": "mutation($id: ID!) { enablePullRequestAutoMerge(input: { pullRequestId: $id }) { clientMutationId } }", | ||
"variables": { | ||
"id": "'"${{ steps.get_pr_id.outputs.node_id }}"'" | ||
} | ||
}' \ | ||
"https://api.github.com/graphql") | ||
echo "$RESPONSE" | ||
if echo "$RESPONSE" | jq -e '.errors' >/dev/null; then | ||
echo "Failed to enable auto merge" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Empty format test | ||
|
||
on: | ||
push | ||
|
||
jobs: | ||
format: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo "format" | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo "test" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,13 +6,15 @@ on: | |
- reopened | ||
- assigned | ||
- unassigned | ||
- labeled | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- review_requested | ||
- assigned | ||
- unassigned | ||
- labeled | ||
|
||
env: | ||
inbox: Inbox | ||
|
@@ -22,14 +24,15 @@ env: | |
project_id: 48 | ||
|
||
jobs: | ||
move_to_inbox: | ||
umino-job: | ||
name: opened_or_reopened | ||
runs-on: ubuntu-latest | ||
if: >- | ||
(github.event_name == 'issues' && github.event.issue.state == 'open') || | ||
(github.event_name == 'pull_request' && github.event.pull_request.state == 'open') && | ||
(github.event.action == 'opened' || github.event.action == 'reopened' || | ||
github.event.action == 'assigned' || github.event.action == 'unassigned') | ||
github.event.action == 'assigned' || github.event.action == 'unassigned' || | ||
(github.event.action == 'labeled' && github.event.label.name == 'hiromishikata:task:offline')) | ||
steps: | ||
- name: Move issue to ${{ env.inbox }} | ||
uses: leonsteinhaeuser/[email protected] | ||
|
@@ -39,3 +42,16 @@ jobs: | |
project_id: ${{ env.project_id }} | ||
resource_node_id: ${{ github.event.pull_request.node_id || github.event.issue.node_id }} | ||
status_value: ${{ env.inbox }} | ||
- name: Comment #offline | ||
if: github.event_name == 'issues' && github.event.action == 'labeled' && github.event.label.name == 'hiromishikata:task:offline' | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const issueComment = { | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: context.issue.number, | ||
body: '#offline' | ||
}; | ||
github.issues.createComment(issueComment); |