Skip to content

Updated github workflows. #1

Updated github workflows.

Updated github workflows. #1

name: 'Version Preview'
on:
workflow_call:
secrets:
GITHUB_TOKEN:

Check failure on line 6 in .github/workflows/version-preview.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/version-preview.yaml

Invalid workflow file

secret name `GITHUB_TOKEN` within `workflow_call` can not be used since it would collide with system reserved name
required: true
defaults:
run:
shell: bash
permissions:
contents: read
pull-requests: write
jobs:
preview:
name: Preview Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Preview Next Version
id: preview
uses: cycjimmy/semantic-release-action@v2
with:
semantic_version: 18.0.0
dry_run: true
branches: |
[
'main',
'master',
{name: '*', prerelease: true}
]
extra_plugins: |
@semantic-release/changelog@6.0.0
@semantic-release/git@10.0.0
conventional-changelog-conventionalcommits@4.6.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Comment PR
uses: actions/github-script@v7
with:
script: |
const published = '${{ steps.preview.outputs.new_release_published }}';
let body = '';
if (published === 'true') {
const releaseType = '${{ steps.preview.outputs.new_release_type }}';
const version = '${{ steps.preview.outputs.new_release_version }}';
const notes = `${{ steps.preview.outputs.new_release_notes }}`;
body = `## Release Preview\n\n**Release Type:** \`${releaseType}\`\n**Next Version:** \`${version}\`\n\n### Release Notes\n${notes}`;
} else {
body = '## Release Preview\n\nNo new release will be created from this PR.';
}
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
});