Skip to content

Commit b8ef3b9

Browse files
authored
Fix piepline #3823 (#3841)
1 parent 7a288fc commit b8ef3b9

4 files changed

Lines changed: 20 additions & 74 deletions

File tree

.github/workflows/PROD-all-studios.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ jobs:
233233
store-image-tags:
234234
needs: [deploy-satellite-studios, deploy-global, deploy-secret]
235235
runs-on: ubuntu-latest
236+
outputs:
237+
STUDIO_SHA: ${{ steps.capture-studio-sha.outputs.STUDIO_SHA }}
236238
steps:
237239
- name: Checkout internal 🛎️
238240
id: checkout-internal
@@ -251,9 +253,10 @@ jobs:
251253
npm install js-yaml
252254
253255
- name: Run script for 'studio'
256+
id: capture-studio-sha
254257
run: |
255258
STUDIO_SHA=$(node ci/storeImageTags.js studio)
256-
echo "STUDIO_SHA=$(STUDIO_SHA)" >> $GITHUB_OUTPUT
259+
echo "STUDIO_SHA=$STUDIO_SHA" >> $GITHUB_OUTPUT
257260
258261
- name: Commit and push changes
259262
run: |
@@ -274,7 +277,7 @@ jobs:
274277
- name: 'Move cards and create discussion and post it to channel'
275278
id: 'get-list'
276279
with:
277-
token: ${{ secrets.PADMS_PAT_READ_PACKAGE }}
280+
token: ${{ secrets.PADMS_PAT }}
278281
commitSHA: 'Studio: ${{ needs.store-image-tags.outputs.STUDIO_SHA }}'
279282
slackWebhook: ${{ secrets.SLACK_WEBHOOK_RELEASE_ANNOUNCEMENT}}
280283
uses: ./.github/workflows/project/

.github/workflows/PROD-all-webs-and-studios.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ jobs:
262262
store-image-tags:
263263
needs: [deploy-webs, deploy-satellite-studios]
264264
runs-on: ubuntu-latest
265+
outputs:
266+
WEB_SHA: ${{ steps.capture-shas.outputs.WEB_SHA }}
267+
STUDIO_SHA: ${{ steps.capture-shas.outputs.STUDIO_SHA }}
265268
steps:
266269
- name: Checkout internal 🛎️
267270
id: checkout-internal
@@ -278,11 +281,12 @@ jobs:
278281
run: |
279282
npm install js-yaml
280283
- name: Run script for 'web' and 'studio'
284+
id: capture-shas
281285
run: |
282286
WEB_SHA=$(node ci/storeImageTags.js web)
283287
STUDIO_SHA=$(node ci/storeImageTags.js studio)
284-
echo "WEB_SHA=$(WEB_SHA)" >> $GITHUB_OUTPUT
285-
echo "STUDIO_SHA=$(STUDIO_SHA)" >> $GITHUB_OUTPUT
288+
echo "WEB_SHA=$WEB_SHA" >> $GITHUB_OUTPUT
289+
echo "STUDIO_SHA=$STUDIO_SHA" >> $GITHUB_OUTPUT
286290
287291
- name: Commit and push changes
288292
run: |
@@ -303,7 +307,7 @@ jobs:
303307
- name: 'Move cards and create discussion and post it to channel'
304308
id: 'get-list'
305309
with:
306-
token: ${{ secrets.PADMS_PAT_READ_PACKAGE }}
307-
commitSHA: 'Web : ${{ needs.store-image-tags.outputs.WEB_SHA }} Studio: ${{ needs.store-image-tags.outputs.WEB_SHA }}'
310+
token: ${{ secrets.PADMS_PAT }}
311+
commitSHA: 'Web : ${{ needs.store-image-tags.outputs.WEB_SHA }} Studio: ${{ needs.store-image-tags.outputs.STUDIO_SHA }}'
308312
slackWebhook: ${{ secrets.SLACK_WEBHOOK_RELEASE_ANNOUNCEMENT}}
309313
uses: ./.github/workflows/project/

.github/workflows/PROD-all-webs.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ jobs:
7979
store-image-tags:
8080
needs: deploy
8181
runs-on: ubuntu-latest
82+
outputs:
83+
WEB_SHA: ${{ steps.capture-web-sha.outputs.WEB_SHA }}
8284
steps:
8385
- name: Checkout internal 🛎️
8486
id: checkout-internal
@@ -98,6 +100,7 @@ jobs:
98100
npm install js-yaml
99101
100102
- name: Run script for 'web'
103+
id: capture-web-sha
101104
run: |
102105
WEB_SHA=$(node ci/storeImageTags.js web)
103106
echo "WEB_SHA=$WEB_SHA" >> $GITHUB_OUTPUT
@@ -121,7 +124,7 @@ jobs:
121124
- name: 'Move cards and create discussion and post it to channel'
122125
id: 'get-list'
123126
with:
124-
token: ${{ secrets.PADMS_PAT_READ_PACKAGE }}
127+
token: ${{ secrets.PADMS_PAT }}
125128
commitSHA: 'Web : ${{ needs.store-image-tags.outputs.WEB_SHA }}'
126129
slackWebhook: ${{ secrets.SLACK_WEBHOOK_RELEASE_ANNOUNCEMENT}}
127130
uses: ./.github/workflows/project/

.github/workflows/project/action.yaml

Lines changed: 3 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# This composite action updates Project V2 statuses after release work is closed.
22
# Closed issues in status "Release" are moved to "Done".
3-
# Closed pull requests in status "PRs" are moved to "Closed".
43
# It also creates a release discussion and posts the link to Slack.
54
name: Move issue to Done status
65
description: 'Move issue'
@@ -30,7 +29,7 @@ runs:
3029
ORGANIZATION: 'equinor'
3130
PROJECT_NUMBER: 965
3231
# Uses [GitHub CLI](https://cli.github.com/manual/) to fetch:
33-
# - closed issues and closed pull requests with their project item status
32+
# - closed issues with their project item status
3433
# - Project V2 field metadata and status option IDs
3534
# - repository IDs needed for discussion creation
3635
# The response is stored in `project_data.json`.
@@ -55,11 +54,6 @@ runs:
5554
number
5655
title
5756
}
58-
... on PullRequest {
59-
__typename
60-
number
61-
title
62-
}
6357
}
6458
fieldValueByName(name: "Status") {
6559
... on ProjectV2ItemFieldSingleSelectValue {
@@ -71,33 +65,6 @@ runs:
7165
}
7266
}
7367
}
74-
pullRequests(states: [CLOSED], first: 50, orderBy: { field: UPDATED_AT, direction: DESC }) {
75-
nodes {
76-
id
77-
projectItems(first: 10, includeArchived: false) {
78-
nodes {
79-
id
80-
content {
81-
... on Issue {
82-
__typename
83-
number
84-
title
85-
}
86-
... on PullRequest {
87-
__typename
88-
number
89-
title
90-
}
91-
}
92-
fieldValueByName(name: "Status") {
93-
... on ProjectV2ItemFieldSingleSelectValue {
94-
status: name
95-
}
96-
}
97-
}
98-
}
99-
}
100-
}
10168
projectV2(number: $number) {
10269
id
10370
fields(first: 20) {
@@ -133,24 +100,19 @@ runs:
133100
134101
DONE_OPTION_ID=$(jq -r '.data.organization.projectV2.fields.nodes[] | select(.name=="Status") | .options[] | select(.name=="Done") |.id' project_data.json)
135102
echo "DONE_OPTION_ID=${DONE_OPTION_ID}" >> $GITHUB_ENV
136-
137-
CLOSED_OPTION_ID=$(jq -r '.data.organization.projectV2.fields.nodes[] | select(.name=="Status") | .options[] | select(.name=="Closed") |.id' project_data.json)
138-
echo "CLOSED_OPTION_ID=${CLOSED_OPTION_ID}" >> $GITHUB_ENV
139-
140-
141103
DISCUSSION_CATEGORY_ID=$(jq -r '.data.organization.repository.discussionCategory.id' project_data.json)
142104
echo "DISCUSSION_CATEGORY_ID=${DISCUSSION_CATEGORY_ID}" >> $GITHUB_ENV
143105
144106
REPOSITORY_ID=$(jq -r '.data.organization.repository.id' project_data.json)
145107
echo "REPOSITORY_ID=${REPOSITORY_ID}" >> $GITHUB_ENV
146108
147-
# Updates project item statuses based on content type and current status.
109+
# Updates issue project item statuses in "Release" to "Done".
148110
- name: Set fields
149111
shell: bash
150112
env:
151113
GH_TOKEN: ${{ inputs.token }}
152114

153-
# Sets the value of the `Status` field to `Done` for issues and `Closed` for pull requests.
115+
# Sets the value of the `Status` field to `Done` for issues.
154116
run: |
155117
ISSUE_ITEM_IDS=$(jq '.data.organization.repository.issues.nodes[].projectItems.nodes[] | select(.fieldValueByName.status =="Release" and .content.__typename == "Issue") | .id' project_data.json)
156118
echo "$ISSUE_ITEM_IDS"
@@ -177,32 +139,6 @@ runs:
177139
}
178140
}' -f project=$PROJECT_ID -f item=$id -f status_field=$STATUS_FIELD_ID -f status_value=$DONE_OPTION_ID --silent
179141
done
180-
181-
PR_ITEM_IDS=$(jq '.data.organization.repository.pullRequests.nodes[].projectItems.nodes[] | select(.fieldValueByName.status =="PRs" and .content.__typename == "PullRequest") | .id' project_data.json)
182-
echo "$PR_ITEM_IDS"
183-
for id in $PR_ITEM_IDS; do
184-
echo "Moving pull request $id to Closed ($CLOSED_OPTION_ID)"
185-
gh api graphql -f query='
186-
mutation (
187-
$project: ID!
188-
$item: ID!
189-
$status_field: ID!
190-
$status_value: String!
191-
) {
192-
set_status: updateProjectV2ItemFieldValue(input: {
193-
projectId: $project
194-
itemId: $item
195-
fieldId: $status_field
196-
value: {
197-
singleSelectOptionId: $status_value
198-
}
199-
}) {
200-
projectV2Item {
201-
id
202-
}
203-
}
204-
}' -f project=$PROJECT_ID -f item=$id -f status_field=$STATUS_FIELD_ID -f status_value=$CLOSED_OPTION_ID --silent
205-
done
206142
- name: Create discussion
207143
shell: bash
208144
env:

0 commit comments

Comments
 (0)