Skip to content

fix example in README #26

fix example in README

fix example in README #26

Workflow file for this run

name: recreate major and minor tags
on:
push:
tags: v*.*.*
jobs:
retag:
runs-on: ubuntu-latest
- name: Recreate Major and Minor Tags

Check failure on line 10 in .github/workflows/retag.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/retag.yml

Invalid workflow file

You have an error in your yaml syntax on line 10
uses: actions/github-script@v5
with:
script: |
const {
ref,
repo: {
owner,
repo,
},
sha,
} = context;
const tagMatch = ref.match(/^((v[0-9]+)\.[0-9]+)\.[0-9]+$/);
if (tagMatch !== null) {
const [, major, minor] = tagMatch;
for (const tag of [major, minor]) {
const tagRef = 'refs/tags/' + tag;
github.rest.git.createRef({
owner,
repo,
ref: tagRef,
sha,
}).catch(err => {
if (err.status !== 422) {
throw err;
}
github.rest.git.updateRef({
owner,
repo,
ref: tagRef,
sha,
});
});
}
}