Skip to content

Commit

Permalink
# Urgent comment out failing workflow step
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpojer committed Oct 21, 2024
1 parent d7a3b09 commit 10bfd9c
Showing 1 changed file with 34 additions and 34 deletions.
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

0 comments on commit 10bfd9c

Please sign in to comment.