Skip to content

# Urgent comment out failing workflow step #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions .github/workflows/release_draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,40 +43,40 @@ jobs:
}
tag-name: ${{ github.event.inputs.tag-name }}

- name: Check tag's correct version increment
uses: actions/github-script@v7
with:
script: |
const newTag = core.getInput('tag-name');

// get latest tag
const { data: refs } = await github.rest.git.listMatchingRefs({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/'
});

if (refs.length === 0) {
// No existing tags, so any new tag is valid
console.log('No existing tags found. Any new tag is considered valid.');
return;
}

const latestTag = refs.sort((a, b) => new Date(b.object.date) - new Date(a.object.date))[0].ref.replace('refs/tags/', '');
const latestVersion = latestTag.replace('v', '').split('.').map(Number);
const newVersion = newTag.replace('v', '').split('.').map(Number);

// check tag's correct version increase
const isValid = (latestVersion[0] === newVersion[0] && latestVersion[1] === newVersion[1] && newVersion[2] === latestVersion[2] + 1) ||
(latestVersion[0] === newVersion[0] && newVersion[1] === latestVersion[1] + 1 && newVersion[2] === 0) ||
(newVersion[0] === latestVersion[0] + 1 && newVersion[1] === 0 && newVersion[2] === 0);

if (!isValid) {
core.setFailed('New tag is not one version higher than the latest tag');
return;
}

tag-name: ${{ github.event.inputs.tag-name }}
# - name: Check tag's correct version increment
# uses: actions/github-script@v7
# with:
# script: |
# const newTag = core.getInput('tag-name');
#
# // get latest tag
# const { data: refs } = await github.rest.git.listMatchingRefs({
# owner: context.repo.owner,
# repo: context.repo.repo,
# ref: 'tags/'
# });
#
# if (refs.length === 0) {
# // No existing tags, so any new tag is valid
# console.log('No existing tags found. Any new tag is considered valid.');
# return;
# }
#
# const latestTag = refs.sort((a, b) => new Date(b.object.date) - new Date(a.object.date))[0].ref.replace('refs/tags/', '');
# const latestVersion = latestTag.replace('v', '').split('.').map(Number);
# const newVersion = newTag.replace('v', '').split('.').map(Number);
#
# // check tag's correct version increase
# const isValid = (latestVersion[0] === newVersion[0] && latestVersion[1] === newVersion[1] && newVersion[2] === latestVersion[2] + 1) ||
# (latestVersion[0] === newVersion[0] && newVersion[1] === latestVersion[1] + 1 && newVersion[2] === 0) ||
# (newVersion[0] === latestVersion[0] + 1 && newVersion[1] === 0 && newVersion[2] === 0);
#
# if (!isValid) {
# core.setFailed('New tag is not one version higher than the latest tag');
# return;
# }
#
# tag-name: ${{ github.event.inputs.tag-name }}

release-draft:
needs: check-tag
Expand Down
Loading