Skip to content

Commit b210b79

Browse files
committed
feat(github-actions): enabled the permissions needed for the reusable workflow
1 parent d1ed7f4 commit b210b79

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

src/semantic-release/ci-providers/github-workflows/lifter-test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ suite('github-workflows lifter for semantic-release', () => {
2626
const reusableReleaseWorkflowReference = any.string();
2727
const modernReleaseJobDefinition = {
2828
needs: neededJobsToTriggerRelease,
29+
permissions: {
30+
contents: 'write',
31+
'id-token': 'write',
32+
issues: 'write',
33+
'pull-requests': 'write'
34+
},
2935
uses: reusableReleaseWorkflowReference,
3036
// eslint-disable-next-line no-template-curly-in-string
3137
secrets: {NPM_TOKEN: '${{ secrets.NPM_PUBLISH_TOKEN }}'}

src/semantic-release/ci-providers/github-workflows/lifter.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ export default async function ({projectRoot, nodeVersion}) {
3434
...removeCycjimmyActionFrom(otherJobs),
3535
release: {
3636
needs: determineTriggerNeedsFrom(otherJobs),
37+
permissions: {
38+
contents: 'write',
39+
'id-token': 'write',
40+
issues: 'write',
41+
'pull-requests': 'write'
42+
},
3743
uses: determineAppropriateWorkflow(nodeVersion),
3844
// eslint-disable-next-line no-template-curly-in-string
3945
secrets: {NPM_TOKEN: '${{ secrets.NPM_PUBLISH_TOKEN }}'}

test/integration/features/step_definitions/github-workflows-steps.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,15 @@ Then('the verification workflow calls the reusable release workflow', async func
106106
const releaseJob = verificationWorkflowJobs.release;
107107

108108
assert.deepEqual(releaseJob.needs, ['verify']);
109+
assert.deepEqual(
110+
releaseJob.permissions,
111+
{
112+
contents: 'write',
113+
'id-token': 'write',
114+
issues: 'write',
115+
'pull-requests': 'write'
116+
}
117+
);
109118

110119
assert.equal(releaseJob.uses, 'form8ion/.github/.github/workflows/release-package.yml@master');
111120
// eslint-disable-next-line no-template-curly-in-string

0 commit comments

Comments
 (0)