Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
3f6f82e1
Commit
3f6f82e1
authored
Jun 27, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first part of workflow for project cards
parent
09339529
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
119 additions
and
1 deletion
+119
-1
label-released-issues.yml
.github/workflows/label-released-issues.yml
+1
-1
update-project-cards.yml
.github/workflows/update-project-cards.yml
+118
-0
No files found.
.github/workflows/label-released-issues.yml
View file @
3f6f82e1
...
...
@@ -12,7 +12,7 @@ on:
type
:
string
outputs
:
issues
:
description
:
"
Comma
separat
ed
list
of
issues
linked
to
commits
in
the
release"
description
:
"
JSON
encod
ed
list
of
issues
linked
to
commits
in
the
release"
value
:
${{ jobs.run.outputs.issues }}
concurrency
:
...
...
.github/workflows/update-project-cards.yml
0 → 100644
View file @
3f6f82e1
name
:
Update project cards for issues
on
:
pull_request
:
workflow_dispatch
:
workflow_call
:
inputs
:
project_name
:
description
:
Name of the project
default
:
Front-end tasks
required
:
true
type
:
string
field_name
:
description
:
Field name to be updated
default
:
Status
required
:
true
type
:
string
field_value
:
description
:
New value of the field
default
:
Released
required
:
true
type
:
string
issues
:
description
:
JSON encoded list of issue numbers to be updated
default
:
'
[900,903,899,912]'
required
:
true
type
:
string
concurrency
:
group
:
${{ github.workflow }}/${{ inputs.project_name }}/${{ inputs.field_name }}
cancel-in-progress
:
true
jobs
:
run
:
name
:
Run
runs-on
:
ubuntu-latest
steps
:
-
name
:
Getting project info
id
:
project
uses
:
actions/github-script@v6
env
:
PROJECT_NAME
:
${{ github.event.inputs.project_name }}
FIELD_NAME
:
${{ github.event.inputs.field_name }}
FIELD_VALUE
:
${{ github.event.inputs.field_value }}
with
:
script
:
|
const response = await github.graphql(`
query ($login: String!, $q: String!) {
organization(login: $login) {
projectsV2(query: $q, first: 1) {
nodes {
id,
title,
number,
fields(first: 20) {
nodes {
... on ProjectV2Field {
id
name
}
... on ProjectV2SingleSelectField {
id
name
options {
id
name
}
}
}
}
}
}
}
}
`, {
login: context.repo.owner,
q: process.env.PROJECT_NAME,
});
const { organization: { projectsV2: { nodes: projects } } } = response;
if (projects.length === 0) {
core.setFailed('Project not found.');
return;
}
if (projects.length > 1) {
core.info(`Fould ${ projects.length } with the similar name:`);
projects.forEach((issue) => {
core.info(` #${ projects.number } - ${ projects.title }`);
})
core.setFailed('Fould multiple projects with the similar name. Cannot determine which one to use.');
return;
}
const { id: projectId, fields: { nodes: fields } } = projects[0];
const field = fields.find((field) => field.name === process.env.FIELD_NAME);
if (!field) {
core.setFailed(`Field with name "${ process.env.FIELD_NAME }" not found in the project.`);
return;
}
const option = field.options.find((option) => option.name === process.env.FIELD_VALUE);
if (!option) {
core.setFailed(`Option with name "${ process.env.FIELD_VALUE }" not found in the field possible values.`);
return;
}
core.info('Found following info:');
core.info(' project_id: ', projectId);
core.info(' field_id: ', field.id);
core.info(' field_value_id: ', option.id);
core.setOutput('id', projectId);
core.setOutput('field_id', field.id);
core.setOutput('field_value_id', option.id);
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment