gatsby-plugin-rudderstack 2.0.0 → 3.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintcache +1 -0
- package/.eslintignore +8 -0
- package/.eslintrc.json +41 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +39 -0
- package/.github/ISSUE_TEMPLATE/feature-request.md +20 -0
- package/.github/pull_request_template.md +13 -0
- package/.github/workflows/build-and-quality-checks.yml +36 -0
- package/.github/workflows/check_pr_title.yml +17 -0
- package/.github/workflows/codeql-analysis.yml +70 -0
- package/.github/workflows/create-hotfix-branch.yml +21 -0
- package/.github/workflows/deploy-npm.yml +82 -0
- package/.github/workflows/draft-new-release.yml +86 -0
- package/.github/workflows/housekeeping.yaml +40 -0
- package/.github/workflows/notion-pr-sync.yml +55 -0
- package/.github/workflows/publish-new-release.yml +111 -0
- package/.github/workflows/test.yml +44 -0
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +4 -0
- package/.idea/gatsby-plugin-rudderstack.iml +10 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/.nvmrc +1 -0
- package/.prettierignore +6 -0
- package/.prettierrc +7 -0
- package/CODEOWNERS +2 -0
- package/CODE_OF_CONDUCT.md +80 -0
- package/CONTRIBUTING.md +47 -0
- package/commitlint.config.js +3 -0
- package/dist/LICENSE.md +21 -0
- package/dist/README.md +331 -0
- package/dist/gatsby-node.js +1 -0
- package/{gatsby-ssr.js → dist/gatsby-ssr.js} +13 -9
- package/dist/package.json +98 -0
- package/package.json +1 -1
- package/sonar-project.properties +35 -0
- package/CHANGELOG.md +0 -14
- /package/{gatsby-browser.js → dist/gatsby-browser.js} +0 -0
package/.eslintcache
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"/Volumes/sourcecode/gatsby-plugin-rudderstack/src/gatsby-ssr.js":"1"},{"size":4519,"mtime":1689958450990}]
|
package/.eslintignore
ADDED
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"browser": true,
|
|
4
|
+
"es2020": true,
|
|
5
|
+
"jest": true
|
|
6
|
+
},
|
|
7
|
+
"extends": ["airbnb-base", "plugin:sonarjs/recommended", "prettier", "plugin:compat/recommended"],
|
|
8
|
+
"plugins": ["unicorn", "compat"],
|
|
9
|
+
"parser": "@babel/eslint-parser",
|
|
10
|
+
"globals": {},
|
|
11
|
+
"parserOptions": {
|
|
12
|
+
"ecmaVersion": 11,
|
|
13
|
+
"sourceType": "module"
|
|
14
|
+
},
|
|
15
|
+
"rules": {
|
|
16
|
+
"import/prefer-default-export": "off",
|
|
17
|
+
"unicorn/filename-case": [
|
|
18
|
+
"error",
|
|
19
|
+
{ "cases": { "camelCase": true, "pascalCase": true, "kebabCase": true } }
|
|
20
|
+
],
|
|
21
|
+
"unicorn/no-instanceof-array": "error",
|
|
22
|
+
"unicorn/no-static-only-class": "error",
|
|
23
|
+
"unicorn/consistent-destructuring": "error",
|
|
24
|
+
"unicorn/better-regex": "error",
|
|
25
|
+
"unicorn/no-for-loop": "error",
|
|
26
|
+
"unicorn/prefer-array-some": "error",
|
|
27
|
+
"unicorn/explicit-length-check": "error",
|
|
28
|
+
"unicorn/prefer-array-find": "error",
|
|
29
|
+
"unicorn/no-lonely-if": "error",
|
|
30
|
+
"unicorn/prefer-includes": "error",
|
|
31
|
+
"unicorn/prefer-array-flat-map": "error",
|
|
32
|
+
"unicorn/no-useless-spread": "error",
|
|
33
|
+
"unicorn/no-useless-length-check": "error",
|
|
34
|
+
"unicorn/prefer-export-from": "error",
|
|
35
|
+
"sonarjs/prefer-immediate-return": "off",
|
|
36
|
+
"sonarjs/no-nested-template-literals": "off",
|
|
37
|
+
"sonarjs/max-switch-cases": "off",
|
|
38
|
+
"sonarjs/cognitive-complexity": ["error", 40],
|
|
39
|
+
"compat/compat": "warn"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: "[ISSUE]"
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the issue**
|
|
11
|
+
Enter a clear and concise description of what the bug/issue is.
|
|
12
|
+
|
|
13
|
+
**To Reproduce**
|
|
14
|
+
Mention the steps to reproduce the behavior that causes the bug/issue:
|
|
15
|
+
|
|
16
|
+
1. Go to '...'
|
|
17
|
+
2. Click on '....'
|
|
18
|
+
3. Scroll down to '....'
|
|
19
|
+
4. See error
|
|
20
|
+
|
|
21
|
+
**Expected behavior**
|
|
22
|
+
A clear and concise description of what you expected to happen.
|
|
23
|
+
|
|
24
|
+
**Screenshots**
|
|
25
|
+
If applicable, add screenshots to help explain your problem.
|
|
26
|
+
|
|
27
|
+
**Desktop (please complete the following information):**
|
|
28
|
+
- OS: [e.g. iOS]
|
|
29
|
+
- Browser [e.g. chrome, safari]
|
|
30
|
+
- Version [e.g. 22]
|
|
31
|
+
|
|
32
|
+
**Smartphone (please complete the following information):**
|
|
33
|
+
- Device: [e.g. iPhone6]
|
|
34
|
+
- OS: [e.g. iOS8.1]
|
|
35
|
+
- Browser [e.g. stock browser, safari]
|
|
36
|
+
- Version [e.g. 22]
|
|
37
|
+
|
|
38
|
+
**Additional context**
|
|
39
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: "[ENHANCEMENT]"
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
**Fixes** # (*issue*)
|
|
2
|
+
|
|
3
|
+
## Type of change
|
|
4
|
+
- [ ] Bug fix (non-breaking change which fixes an issue)
|
|
5
|
+
- [ ] New feature (non-breaking change which adds functionality)
|
|
6
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
|
7
|
+
- [ ] This change requires a documentation update
|
|
8
|
+
## Checklist:
|
|
9
|
+
- [ ] My code follows the style guidelines of this project
|
|
10
|
+
- [ ] I have performed a self-review of my own code
|
|
11
|
+
- [ ] I have commented my code, particularly in hard-to-understand areas
|
|
12
|
+
- [ ] I have added unit tests for the code
|
|
13
|
+
- [ ] I have made corresponding changes to the documentation
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: Build & Code Quality Checks
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: ['main', 'develop']
|
|
6
|
+
types: ['opened', 'reopened', 'synchronize']
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
name: Build & Code Quality Checks
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout
|
|
15
|
+
uses: actions/checkout@v3
|
|
16
|
+
|
|
17
|
+
- name: Setup Node
|
|
18
|
+
uses: actions/setup-node@v3
|
|
19
|
+
with:
|
|
20
|
+
node-version-file: '.nvmrc'
|
|
21
|
+
cache: 'npm'
|
|
22
|
+
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
env:
|
|
25
|
+
HUSKY: 0
|
|
26
|
+
run: |
|
|
27
|
+
npm ci
|
|
28
|
+
|
|
29
|
+
- name: Execute quality checks
|
|
30
|
+
run: |
|
|
31
|
+
npm run check:circular
|
|
32
|
+
npm run check:duplicates
|
|
33
|
+
|
|
34
|
+
- name: Execute security checks
|
|
35
|
+
run: |
|
|
36
|
+
npm run check:security
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: Check PR title
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: ['main', 'develop']
|
|
6
|
+
types: ['opened', 'reopened', 'edited', 'synchronize']
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
check_pr_title:
|
|
10
|
+
name: Check PR title
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout source branch
|
|
14
|
+
uses: actions/checkout@v3
|
|
15
|
+
|
|
16
|
+
- name: Check PR title
|
|
17
|
+
uses: rudderlabs/github-action-check-pr-title@v1.0.7
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
|
2
|
+
# to commit it to your repository.
|
|
3
|
+
#
|
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
|
5
|
+
# or to provide custom queries or build logic.
|
|
6
|
+
#
|
|
7
|
+
# ******** NOTE ********
|
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
|
10
|
+
# supported CodeQL languages.
|
|
11
|
+
#
|
|
12
|
+
name: 'CodeQL'
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
push:
|
|
16
|
+
branches: [main, develop]
|
|
17
|
+
pull_request:
|
|
18
|
+
# The branches below must be a subset of the branches above
|
|
19
|
+
branches: [main, develop]
|
|
20
|
+
schedule:
|
|
21
|
+
- cron: '0 0 * * *'
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
analyze:
|
|
25
|
+
name: Analyze
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
permissions:
|
|
28
|
+
actions: read
|
|
29
|
+
contents: read
|
|
30
|
+
security-events: write
|
|
31
|
+
|
|
32
|
+
strategy:
|
|
33
|
+
fail-fast: false
|
|
34
|
+
matrix:
|
|
35
|
+
language: ['javascript']
|
|
36
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
|
37
|
+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
|
38
|
+
|
|
39
|
+
steps:
|
|
40
|
+
- name: Checkout repository
|
|
41
|
+
uses: actions/checkout@v3
|
|
42
|
+
|
|
43
|
+
# Initializes the CodeQL tools for scanning.
|
|
44
|
+
- name: Initialize CodeQL
|
|
45
|
+
uses: github/codeql-action/init@v2
|
|
46
|
+
with:
|
|
47
|
+
languages: ${{ matrix.language }}
|
|
48
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
49
|
+
# By default, queries listed here will override any specified in a config file.
|
|
50
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
51
|
+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
|
52
|
+
|
|
53
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
54
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
|
55
|
+
- name: Autobuild
|
|
56
|
+
uses: github/codeql-action/autobuild@v2
|
|
57
|
+
|
|
58
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
|
59
|
+
# 📚 https://git.io/JvXDl
|
|
60
|
+
|
|
61
|
+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
62
|
+
# and modify them (or add more) to build your code if your project
|
|
63
|
+
# uses a compiled language
|
|
64
|
+
|
|
65
|
+
#- run: |
|
|
66
|
+
# make bootstrap
|
|
67
|
+
# make release
|
|
68
|
+
|
|
69
|
+
- name: Perform CodeQL Analysis
|
|
70
|
+
uses: github/codeql-action/analyze@v2
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Create new hotfix branch
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
hotfix_name:
|
|
7
|
+
description: Hotfix branch name
|
|
8
|
+
required: true
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
create-branch:
|
|
12
|
+
name: Create new branch
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
if: github.ref == 'refs/heads/main'
|
|
15
|
+
steps:
|
|
16
|
+
- name: Create branch
|
|
17
|
+
uses: peterjgrainger/action-create-branch@v2.4.0
|
|
18
|
+
env:
|
|
19
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
20
|
+
with:
|
|
21
|
+
branch: 'hotfix/${{ github.event.inputs.hotfix_name }}'
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
name: Deploy to NPM
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
pull_request:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
types:
|
|
9
|
+
- closed
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write # allows the JWT to be requested from GitHub's OIDC provider
|
|
13
|
+
contents: read # This is required for actions/checkout
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
deploy-tag:
|
|
17
|
+
name: Deploy to NPM
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
if: (startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/main')) || ((startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix-release/')) && github.event.pull_request.merged == true) # only merged pull requests must trigger this job
|
|
20
|
+
steps:
|
|
21
|
+
- name: Checkout source branch
|
|
22
|
+
uses: actions/checkout@v3
|
|
23
|
+
|
|
24
|
+
- name: Setup Node
|
|
25
|
+
uses: actions/setup-node@v3
|
|
26
|
+
with:
|
|
27
|
+
node-version-file: '.nvmrc'
|
|
28
|
+
cache: 'npm'
|
|
29
|
+
|
|
30
|
+
- name: Build files
|
|
31
|
+
env:
|
|
32
|
+
HUSKY: 0
|
|
33
|
+
run: |
|
|
34
|
+
npm ci
|
|
35
|
+
npm run build
|
|
36
|
+
|
|
37
|
+
- name: Publish package to NPM
|
|
38
|
+
env:
|
|
39
|
+
HUSKY: 0
|
|
40
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
41
|
+
run: |
|
|
42
|
+
npm set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
|
|
43
|
+
cd dist
|
|
44
|
+
npm publish
|
|
45
|
+
|
|
46
|
+
- name: Get new version number
|
|
47
|
+
run: |
|
|
48
|
+
current_version=$(jq -r .version package.json)
|
|
49
|
+
echo "CURRENT_VERSION_VALUE=$current_version" >> $GITHUB_ENV
|
|
50
|
+
echo "DATE=$(date)" >> $GITHUB_ENV
|
|
51
|
+
|
|
52
|
+
- name: Send message to Slack channel
|
|
53
|
+
id: slack
|
|
54
|
+
uses: slackapi/slack-github-action@v1.23.0
|
|
55
|
+
env:
|
|
56
|
+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
57
|
+
PROJECT_NAME: 'Gatsby Plugin Rudderstack'
|
|
58
|
+
NPM_PACKAGE_URL: 'https://www.npmjs.com/package/rudder-sdk-js'
|
|
59
|
+
with:
|
|
60
|
+
channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }}
|
|
61
|
+
payload: |
|
|
62
|
+
{
|
|
63
|
+
"blocks": [
|
|
64
|
+
{
|
|
65
|
+
"type": "header",
|
|
66
|
+
"text": {
|
|
67
|
+
"type": "plain_text",
|
|
68
|
+
"text": "New release: ${{ env.PROJECT_NAME }}"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"type": "divider"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"type": "section",
|
|
76
|
+
"text": {
|
|
77
|
+
"type": "mrkdwn",
|
|
78
|
+
"text": "*Release: <${{ env.NPM_PACKAGE_URL }}|${{ env.CURRENT_VERSION_VALUE }}>*\n${{ env.DATE }}"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
name: Draft new release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
draft-new-release:
|
|
8
|
+
name: Draft a new release
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
if: startsWith(github.ref, 'refs/heads/develop') || startsWith(github.ref, 'refs/heads/hotfix/')
|
|
11
|
+
steps:
|
|
12
|
+
- name: Checkout source branch
|
|
13
|
+
uses: actions/checkout@v3
|
|
14
|
+
with:
|
|
15
|
+
fetch-depth: 0
|
|
16
|
+
|
|
17
|
+
- name: Setup Node
|
|
18
|
+
uses: actions/setup-node@v3
|
|
19
|
+
with:
|
|
20
|
+
node-version-file: '.nvmrc'
|
|
21
|
+
cache: 'npm'
|
|
22
|
+
|
|
23
|
+
# In order to make a commit, we need to initialize a user.
|
|
24
|
+
# You may choose to write something less generic here if you want, it doesn't matter functionality wise.
|
|
25
|
+
- name: Initialize mandatory git config
|
|
26
|
+
run: |
|
|
27
|
+
git config user.name "GitHub actions"
|
|
28
|
+
git config user.email noreply@github.com
|
|
29
|
+
|
|
30
|
+
# Calculate the next release version based on conventional semantic release
|
|
31
|
+
- name: Create release branch
|
|
32
|
+
id: create-release
|
|
33
|
+
env:
|
|
34
|
+
HUSKY: 0
|
|
35
|
+
run: |
|
|
36
|
+
source_branch_name=${GITHUB_REF##*/}
|
|
37
|
+
release_type=release
|
|
38
|
+
grep -q "hotfix/" <<< "${GITHUB_REF}" && release_type=hotfix-release
|
|
39
|
+
git fetch origin main --depth=1
|
|
40
|
+
git merge origin/main
|
|
41
|
+
current_version=$(jq -r .version package.json)
|
|
42
|
+
|
|
43
|
+
npx standard-version --skip.commit --skip.tag --skip.changelog
|
|
44
|
+
new_version=$(jq -r .version package.json)
|
|
45
|
+
git reset --hard
|
|
46
|
+
|
|
47
|
+
branch_name="${release_type}/${new_version}"
|
|
48
|
+
|
|
49
|
+
echo "Source branch for new release is $source_branch_name"
|
|
50
|
+
echo "Current version is $current_version"
|
|
51
|
+
echo "Release type is $release_type"
|
|
52
|
+
echo "New version is $new_version"
|
|
53
|
+
echo "New release branch name is $branch_name"
|
|
54
|
+
git checkout -b "$branch_name"
|
|
55
|
+
git push --set-upstream origin "$branch_name"
|
|
56
|
+
|
|
57
|
+
echo "source_branch_name=$source_branch_name" >> $GITHUB_OUTPUT
|
|
58
|
+
echo "branch_name=$branch_name" >> $GITHUB_OUTPUT
|
|
59
|
+
echo "new_version=$new_version" >> $GITHUB_OUTPUT
|
|
60
|
+
echo "CURRENT_VERSION_VALUE=$current_version" >> $GITHUB_ENV
|
|
61
|
+
echo "NEW_VERSION_VALUE=$new_version" >> $GITHUB_ENV
|
|
62
|
+
|
|
63
|
+
- name: Update changelog & bump version
|
|
64
|
+
id: finish-release
|
|
65
|
+
env:
|
|
66
|
+
HUSKY: 0
|
|
67
|
+
run: |
|
|
68
|
+
echo "Current version: $CURRENT_VERSION_VALUE"
|
|
69
|
+
echo "New version: $NEW_VERSION_VALUE"
|
|
70
|
+
npx replace $CURRENT_VERSION_VALUE $NEW_VERSION_VALUE sonar-project.properties
|
|
71
|
+
git add sonar-project.properties
|
|
72
|
+
npx standard-version -a --skip.tag
|
|
73
|
+
|
|
74
|
+
- name: Push new version in release branch & tag
|
|
75
|
+
run: |
|
|
76
|
+
git push
|
|
77
|
+
|
|
78
|
+
- name: Create pull request into main
|
|
79
|
+
uses: repo-sync/pull-request@v2
|
|
80
|
+
with:
|
|
81
|
+
source_branch: ${{ steps.create-release.outputs.branch_name }}
|
|
82
|
+
destination_branch: 'main'
|
|
83
|
+
github_token: ${{ secrets.PAT }}
|
|
84
|
+
pr_title: 'chore(release): pulling ${{ steps.create-release.outputs.branch_name }} into main'
|
|
85
|
+
pr_body: ':crown: *An automated PR*'
|
|
86
|
+
pr_reviewer: 'bardisg'
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Handle stale PRs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: '42 1 * * *'
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
prs:
|
|
9
|
+
name: Clean up stale prs
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
issues: write
|
|
14
|
+
pull-requests: write
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/stale@v6
|
|
18
|
+
with:
|
|
19
|
+
repo-token: ${{ github.token }}
|
|
20
|
+
operations-per-run: 200
|
|
21
|
+
stale-pr-message: 'This PR is considered to be stale. It has been open 20 days with no further activity thus it is going to be closed in 10 days. To avoid such a case please consider removing the stale label manually or add a comment to the PR.'
|
|
22
|
+
days-before-pr-stale: 20
|
|
23
|
+
days-before-pr-close: 10
|
|
24
|
+
stale-pr-label: 'Stale'
|
|
25
|
+
|
|
26
|
+
branches:
|
|
27
|
+
name: Cleanup old branches
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
steps:
|
|
30
|
+
- name: Checkout repository
|
|
31
|
+
uses: actions/checkout@v2
|
|
32
|
+
- name: Run delete-old-branches-action
|
|
33
|
+
uses: beatlabs/delete-old-branches-action@v0.0.9
|
|
34
|
+
with:
|
|
35
|
+
repo_token: ${{ github.token }}
|
|
36
|
+
date: '2 months ago'
|
|
37
|
+
dry_run: false
|
|
38
|
+
delete_tags: false
|
|
39
|
+
extra_protected_branch_regex: ^(main|master|develop)$
|
|
40
|
+
exclude_open_pr_branches: true
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
name: Notion PR Sync
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issues:
|
|
5
|
+
types:
|
|
6
|
+
[
|
|
7
|
+
opened,
|
|
8
|
+
edited,
|
|
9
|
+
deleted,
|
|
10
|
+
transferred,
|
|
11
|
+
pinned,
|
|
12
|
+
unpinned,
|
|
13
|
+
closed,
|
|
14
|
+
reopened,
|
|
15
|
+
assigned,
|
|
16
|
+
unassigned,
|
|
17
|
+
labeled,
|
|
18
|
+
unlabeled,
|
|
19
|
+
locked,
|
|
20
|
+
unlocked,
|
|
21
|
+
milestoned,
|
|
22
|
+
demilestoned,
|
|
23
|
+
]
|
|
24
|
+
pull_request:
|
|
25
|
+
types:
|
|
26
|
+
[
|
|
27
|
+
assigned,
|
|
28
|
+
unassigned,
|
|
29
|
+
labeled,
|
|
30
|
+
unlabeled,
|
|
31
|
+
opened,
|
|
32
|
+
edited,
|
|
33
|
+
closed,
|
|
34
|
+
reopened,
|
|
35
|
+
synchronize,
|
|
36
|
+
converted_to_draft,
|
|
37
|
+
ready_for_review,
|
|
38
|
+
locked,
|
|
39
|
+
unlocked,
|
|
40
|
+
review_requested,
|
|
41
|
+
review_request_removed,
|
|
42
|
+
auto_merge_enabled,
|
|
43
|
+
auto_merge_disabled,
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
jobs:
|
|
47
|
+
request:
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
steps:
|
|
50
|
+
- name: Sync GitHub PRs to Notion
|
|
51
|
+
uses: sivashanmukh/github-notion-pr-sync@1.0.0
|
|
52
|
+
with:
|
|
53
|
+
notionKey: ${{ secrets.NOTION_BOT_KEY }}
|
|
54
|
+
notionDatabaseId: ${{ secrets.NOTION_PR_DB_ID }}
|
|
55
|
+
githubKey: ${{ secrets.PAT }}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
name: Publish new github release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
types:
|
|
8
|
+
- closed
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
release:
|
|
12
|
+
name: Publish new release
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
if: (startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix-release/')) && github.event.pull_request.merged == true # only merged pull requests must trigger this job
|
|
15
|
+
steps:
|
|
16
|
+
- name: Extract version from branch name (for release branches)
|
|
17
|
+
id: extract-version
|
|
18
|
+
run: |
|
|
19
|
+
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
|
|
20
|
+
VERSION=${BRANCH_NAME#hotfix-}
|
|
21
|
+
VERSION=${VERSION#release/}
|
|
22
|
+
|
|
23
|
+
echo "release_version=$VERSION" >> $GITHUB_OUTPUT
|
|
24
|
+
|
|
25
|
+
- name: Checkout
|
|
26
|
+
uses: actions/checkout@v3
|
|
27
|
+
with:
|
|
28
|
+
fetch-depth: 0
|
|
29
|
+
|
|
30
|
+
- name: Setup Node
|
|
31
|
+
uses: actions/setup-node@v3
|
|
32
|
+
with:
|
|
33
|
+
node-version-file: '.nvmrc'
|
|
34
|
+
cache: 'npm'
|
|
35
|
+
|
|
36
|
+
# In order to make a commit, we need to initialize a user.
|
|
37
|
+
# You may choose to write something less generic here if you want, it doesn't matter functionality wise.
|
|
38
|
+
- name: Initialize mandatory git config
|
|
39
|
+
run: |
|
|
40
|
+
git config user.name "GitHub actions"
|
|
41
|
+
git config user.email noreply@github.com
|
|
42
|
+
|
|
43
|
+
- name: Create GitHub Release
|
|
44
|
+
id: create_release
|
|
45
|
+
env:
|
|
46
|
+
HUSKY: 0
|
|
47
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
48
|
+
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
49
|
+
run: |
|
|
50
|
+
git tag -a v${{ steps.extract-version.outputs.release_version }} -m "chore: release v${{ steps.extract-version.outputs.release_version }}"
|
|
51
|
+
git push origin refs/tags/v${{ steps.extract-version.outputs.release_version }}
|
|
52
|
+
npx conventional-github-releaser -p angular
|
|
53
|
+
echo "DATE=$(date)" >> $GITHUB_ENV
|
|
54
|
+
|
|
55
|
+
- name: Create pull request into staging
|
|
56
|
+
uses: repo-sync/pull-request@v2
|
|
57
|
+
with:
|
|
58
|
+
source_branch: 'main'
|
|
59
|
+
destination_branch: 'develop'
|
|
60
|
+
github_token: ${{ secrets.PAT }}
|
|
61
|
+
pr_title: 'chore(release): pulling main into develop post release v${{ steps.extract-version.outputs.release_version }}'
|
|
62
|
+
pr_body: ':crown: *An automated PR*'
|
|
63
|
+
pr_reviewer: 'bardisg'
|
|
64
|
+
|
|
65
|
+
- name: Delete hotfix release branch
|
|
66
|
+
uses: koj-co/delete-merged-action@master
|
|
67
|
+
if: startsWith(github.event.pull_request.head.ref, 'hotfix-release/')
|
|
68
|
+
with:
|
|
69
|
+
branches: 'hotfix-release/*'
|
|
70
|
+
env:
|
|
71
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
72
|
+
|
|
73
|
+
- name: Delete release branch
|
|
74
|
+
uses: koj-co/delete-merged-action@master
|
|
75
|
+
if: startsWith(github.event.pull_request.head.ref, 'release/')
|
|
76
|
+
with:
|
|
77
|
+
branches: 'release/*'
|
|
78
|
+
env:
|
|
79
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
80
|
+
|
|
81
|
+
- name: Send message to Slack channel
|
|
82
|
+
id: slack
|
|
83
|
+
uses: slackapi/slack-github-action@v1.23.0
|
|
84
|
+
env:
|
|
85
|
+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
86
|
+
PROJECT_NAME: 'Gatsby Rudderstack Plugin'
|
|
87
|
+
RELEASES_URL: 'https://github.com/rudderlabs/gatsby-plugin-rudderstack/releases/'
|
|
88
|
+
with:
|
|
89
|
+
channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }}
|
|
90
|
+
payload: |
|
|
91
|
+
{
|
|
92
|
+
"blocks": [
|
|
93
|
+
{
|
|
94
|
+
"type": "header",
|
|
95
|
+
"text": {
|
|
96
|
+
"type": "plain_text",
|
|
97
|
+
"text": "New release: ${{ env.PROJECT_NAME }}"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"type": "divider"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"type": "section",
|
|
105
|
+
"text": {
|
|
106
|
+
"type": "mrkdwn",
|
|
107
|
+
"text": "*Release: <${{env.RELEASES_URL}}${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\n${{ env.DATE }}"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|