style(sls): fix `salt-lint` errors
[arvados-formula.git] / release.config.js
1 module.exports = {
2   branch: 'master',
3   repositoryUrl: 'https://github.com/saltstack-formulas/arvados-formula',
4   plugins: [
5       ['@semantic-release/commit-analyzer', {
6         preset: 'angular',
7         releaseRules: './release-rules.js',
8       }],
9       '@semantic-release/release-notes-generator',
10       ['@semantic-release/changelog', {
11         changelogFile: 'CHANGELOG.md',
12         changelogTitle: '# Changelog',
13       }],
14       ['@semantic-release/exec', {
15         prepareCmd: 'sh ./pre-commit_semantic-release.sh ${nextRelease.version}',
16       }],
17       ['@semantic-release/git', {
18         assets: ['*.md', 'docs/*.rst', 'FORMULA'],
19       }],
20       '@semantic-release/github',
21   ],
22   generateNotes: {
23     preset: 'angular',
24     writerOpts: {
25       // Required due to upstream bug preventing all types being displayed.
26       // Bug: https://github.com/conventional-changelog/conventional-changelog/issues/317
27       // Fix: https://github.com/conventional-changelog/conventional-changelog/pull/410
28       transform: (commit, context) => {
29           const issues = []
30
31           commit.notes.forEach(note => {
32               note.title = `BREAKING CHANGES`
33           })
34
35           // NOTE: Any changes here must be reflected in `CONTRIBUTING.md`.
36           if (commit.type === `feat`) {
37               commit.type = `Features`
38           } else if (commit.type === `fix`) {
39               commit.type = `Bug Fixes`
40           } else if (commit.type === `perf`) {
41               commit.type = `Performance Improvements`
42           } else if (commit.type === `revert`) {
43               commit.type = `Reverts`
44           } else if (commit.type === `docs`) {
45               commit.type = `Documentation`
46           } else if (commit.type === `style`) {
47               commit.type = `Styles`
48           } else if (commit.type === `refactor`) {
49               commit.type = `Code Refactoring`
50           } else if (commit.type === `test`) {
51               commit.type = `Tests`
52           } else if (commit.type === `build`) {
53               commit.type = `Build System`
54           // } else if (commit.type === `chore`) {
55           //     commit.type = `Maintenance`
56           } else if (commit.type === `ci`) {
57               commit.type = `Continuous Integration`
58           } else {
59               return
60           }
61
62           if (commit.scope === `*`) {
63               commit.scope = ``
64           }
65
66           if (typeof commit.hash === `string`) {
67               commit.shortHash = commit.hash.substring(0, 7)
68           }
69
70           if (typeof commit.subject === `string`) {
71               let url = context.repository
72                   ? `${context.host}/${context.owner}/${context.repository}`
73                   : context.repoUrl
74               if (url) {
75                   url = `${url}/issues/`
76                   // Issue URLs.
77                   commit.subject = commit.subject.replace(/#([0-9]+)/g, (_, issue) => {
78                       issues.push(issue)
79                       return `[#${issue}](${url}${issue})`
80                   })
81               }
82               if (context.host) {
83                   // User URLs.
84                   commit.subject = commit.subject.replace(/\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g, (_, username) => {
85                   if (username.includes('/')) {
86                       return `@${username}`
87                   }
88
89                   return `[@${username}](${context.host}/${username})`
90                   })
91               }
92           }
93
94           // remove references that already appear in the subject
95           commit.references = commit.references.filter(reference => {
96               if (issues.indexOf(reference.issue) === -1) {
97                   return true
98               }
99
100               return false
101           })
102
103           return commit
104       },
105     },
106   },
107 };