Commit 83fa4da2 authored by tom's avatar tom

first part of label workflow

parent 3d771944
name: Label released issues
on:
workflow_dispatch:
workflow_call:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
find_release_tags:
name: Get tags of the two latestest releases
runs-on: ubuntu-latest
steps:
- name: Get tags of the two latestest releases
id: tags
uses: actions/github-script@v6
with:
script: |
const { repository: { releases: { nodes: releases } } } = await github.graphql(`
query ($owner: String!, $repo: String!) {
repository(owner: $owner, name: $repo) {
releases(first: 10, orderBy: { field: CREATED_AT, direction: DESC }) {
nodes {
name
tagName
tagCommit {
oid
}
isPrerelease
isDraft
publishedAt
}
}
}
}
`,
{
owner: context.repo.owner,
repo: context.repo.repo,
}
);
const [ { tagName: latestTag }, { tagName: previousTag } ] = releases
.filter(({ isPrerelease, isDraft }) => !isPrerelease && !isDraft);
core.info('Found following tags:');
core.info(' latest: ', latestTag);
core.info(' second latest: ', previousTag);
core.setOutput('latest', latestTag);
core.setOutput('previous', previousTag);
- name: Get info about latest release label
id: label
uses: actions/github-script@v6
env:
LABEL_NAME: ${{ steps.tags.outputs.latest }}
with:
script: |
try {
const result = await octokit.request('GET /repos/{owner}/{repo}/labels/{name}', {
owner: context.repo.owner,
repo: context.repo.repo,
name: process.env.LABEL_NAME,
});
core.info('Found label with id: ', result.data.id);
core.setOutput('id', result.data.id);
} catch (error) {
if (error.status === 404) {
core.info('Nothing has found.');
core.setOutput('id', null);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment