From 1a778f6897cf283b408b4d622d6b4e1f383d747c Mon Sep 17 00:00:00 2001
From: Souma <101255979+5ouma@users.noreply.github.com>
Date: Sat, 9 Mar 2024 16:44:26 +0900
Subject: [PATCH 1/5] ci(pr-check): Fix `on` and the message (#7)
**Issue:** close #
### Checklist
- [ ] This Pull Request introduces a new feature.
- [ ] This Pull Request fixes a bug.
### Description
Runs on every PR change, and the message was wrong.
- [x] I agree to follow the [Code of
Conduct](https://github.com/5ouma/opml-generator/blob/main/.github/CODE_OF_CONDUCT.md).
---
.github/workflows/pr-check.yml | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml
index 5dcee0b..db75267 100644
--- a/.github/workflows/pr-check.yml
+++ b/.github/workflows/pr-check.yml
@@ -1,7 +1,11 @@
name: 🥽 Pull Request Check
on:
- - pull_request_target
+ pull_request:
+ types:
+ - opened
+ - reopened
+ - edited
jobs:
Labeler:
@@ -20,4 +24,4 @@ jobs:
steps:
- name: 🚫 Base Branch is wrong
if: ${{ github.head_ref != 'dev' && github.base_ref == 'main' }}
- run: echo "Base branch should be \`main\`." && return 1
+ run: echo "Base branch should be \`dev\`." && return 1
From 598278ea688a65fd790aa22c1be31e1ea6ecc122 Mon Sep 17 00:00:00 2001
From: Souma <101255979+5ouma@users.noreply.github.com>
Date: Sat, 9 Mar 2024 16:46:31 +0900
Subject: [PATCH 2/5] ci(pre-commit): Remove the Deno hook (#6)
**Issue:** close #
### Checklist
- [ ] This Pull Request introduces a new feature.
- [ ] This Pull Request fixes a bug.
### Description
Because pre-commit.ci can't install Deno runtime.
- [x] I agree to follow the [Code of
Conduct](https://github.com/5ouma/opml-generator/blob/main/.github/CODE_OF_CONDUCT.md).
---
.pre-commit-config.yaml | 6 ------
1 file changed, 6 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 9db7887..96989fc 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -40,9 +40,3 @@ repos:
hooks:
- id: shellcheck
args: ["-e", "SC1071,SC1072,SC1073,SC1090,SC1091,SC2015,SC2148,SC2154"]
-
- - repo: https://github.com/nozaq/pre-commit-deno
- rev: 0.1.0
- hooks:
- - id: deno-fmt
- - id: deno-lint
From a7c92c5313b0f8febdfa205696551d19dc1fe37a Mon Sep 17 00:00:00 2001
From: Souma <101255979+5ouma@users.noreply.github.com>
Date: Tue, 12 Mar 2024 17:03:06 +0900
Subject: [PATCH 3/5] ci(tagpr): Create a new tag automatically (#12)
tagpr creates a tag when the main branch has a new commit.
---
.github/workflows/pr-check.yml | 2 +-
.github/workflows/release.yml | 23 +++++++++++++++++++++++
.tagpr | 8 ++++++++
3 files changed, 32 insertions(+), 1 deletion(-)
create mode 100644 .github/workflows/release.yml
create mode 100644 .tagpr
diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml
index db75267..bf7c723 100644
--- a/.github/workflows/pr-check.yml
+++ b/.github/workflows/pr-check.yml
@@ -23,5 +23,5 @@ jobs:
steps:
- name: 🚫 Base Branch is wrong
- if: ${{ github.head_ref != 'dev' && github.base_ref == 'main' }}
+ if: ${{ github.base_ref == 'main' && github.head_ref != 'dev' && !startsWith(github.base_ref, 'tagpr-from-') }}
run: echo "Base branch should be \`dev\`." && return 1
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..7d9368e
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,23 @@
+name: 🚀 Release
+
+on:
+ push:
+ branches:
+ - "dev"
+
+permissions:
+ pull-requests: write
+
+jobs:
+ Release:
+ runs-on: Ubuntu-Latest
+
+ steps:
+ - name: 🚚 Checkout Repository
+ uses: actions/checkout@v4
+
+ - name: 🏷️ Create a New Tag
+ id: tagpr
+ uses: Songmu/tagpr@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.tagpr b/.tagpr
new file mode 100644
index 0000000..08ac075
--- /dev/null
+++ b/.tagpr
@@ -0,0 +1,8 @@
+[tagpr]
+ releaseBranch = "main"
+ versionFile = "-"
+ vPrefix = true
+ changelog = false
+ release = true
+ majroLabels = "Type: Breaking Change"
+ minorLabels = "Type: Feature"
From 76bf157c8713a23e12ccf7a7d3c3cba830d2d4fc Mon Sep 17 00:00:00 2001
From: Souma <101255979+5ouma@users.noreply.github.com>
Date: Tue, 12 Mar 2024 19:14:52 +0900
Subject: [PATCH 4/5] ci(tagpr): Run tagpr on main branch (#13)
Manually open a PR from dev to main.
---
.github/workflows/branch-delete.yml | 17 +++++++++++++++++
.github/workflows/pr-check.yml | 4 ++--
.github/workflows/release.yml | 3 ++-
3 files changed, 21 insertions(+), 3 deletions(-)
create mode 100644 .github/workflows/branch-delete.yml
diff --git a/.github/workflows/branch-delete.yml b/.github/workflows/branch-delete.yml
new file mode 100644
index 0000000..05d6b6f
--- /dev/null
+++ b/.github/workflows/branch-delete.yml
@@ -0,0 +1,17 @@
+name: ❌ Branch Delete
+
+on:
+ pull_request:
+ types:
+ - closed
+
+jobs:
+ Delete-Branch:
+ runs-on: Ubuntu-Latest
+
+ steps:
+ - name: ❌ Delete Branch
+ if: ${{ github.head_ref != 'dev'}}
+ uses: SvanBoxel/delete-merged-branch@1.4.3
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml
index bf7c723..af7b143 100644
--- a/.github/workflows/pr-check.yml
+++ b/.github/workflows/pr-check.yml
@@ -23,5 +23,5 @@ jobs:
steps:
- name: 🚫 Base Branch is wrong
- if: ${{ github.base_ref == 'main' && github.head_ref != 'dev' && !startsWith(github.base_ref, 'tagpr-from-') }}
- run: echo "Base branch should be \`dev\`." && return 1
+ if: ${{ github.base_ref == 'main' && github.head_ref != 'dev' }}
+ run: echo "Base branch should be \`dev\`." && exit 1
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 7d9368e..5a8f6f9 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -3,9 +3,10 @@ name: 🚀 Release
on:
push:
branches:
- - "dev"
+ - "main"
permissions:
+ contents: write
pull-requests: write
jobs:
From fde3bd505ced2fbe9c49489dcb28188c0fa43b22 Mon Sep 17 00:00:00 2001
From: Souma <101255979+5ouma@users.noreply.github.com>
Date: Tue, 12 Mar 2024 19:23:40 +0900
Subject: [PATCH 5/5] ci(branch-delete): Add `contents: write` permission (#14)
Since it's needed to delete branches.
---
.github/workflows/branch-delete.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.github/workflows/branch-delete.yml b/.github/workflows/branch-delete.yml
index 05d6b6f..45ab806 100644
--- a/.github/workflows/branch-delete.yml
+++ b/.github/workflows/branch-delete.yml
@@ -5,6 +5,9 @@ on:
types:
- closed
+permissions:
+ contents: write
+
jobs:
Delete-Branch:
runs-on: Ubuntu-Latest