Skip to content

Commit 4b3edb3

Browse files
ci:update-closed-issues (#424)
* ci:update-closed-issues Signed-off-by: Tripura Repalle <tripura@blinklabs.io> * ci(update-workflow): Switch to actions/attest Signed-off-by: Tripura Repalle <tripura@blinklabs.io> * ci(update-workflow): Switch to actions/attest Signed-off-by: Tripura Repalle <tripura@blinklabs.io> --------- Signed-off-by: Tripura Repalle <tripura@blinklabs.io>
1 parent ebbee23 commit 4b3edb3

File tree

3 files changed

+65
-3
lines changed

3 files changed

+65
-3
lines changed

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
--data-binary @${_filename} \
8080
https://uploads.github.com/repos/${{ github.repository_owner }}/tx-submit-api/releases/${{ needs.create-draft-release.outputs.RELEASE_ID }}/assets?name=${_filename}
8181
- name: Attest binary
82-
uses: actions/attest-build-provenance@v3
82+
uses: actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4.1.0 https://github.com/actions/attest/releases/tag/v4.1.0
8383
with:
8484
subject-path: 'tx-submit-api'
8585

@@ -136,13 +136,13 @@ jobs:
136136
tags: ${{ steps.meta.outputs.tags }}
137137
labels: ${{ steps.meta.outputs.labels }}
138138
- name: Attest Docker Hub image
139-
uses: actions/attest-build-provenance@v3
139+
uses: actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4.1.0 https://github.com/actions/attest/releases/tag/v4.1.0
140140
with:
141141
subject-name: index.docker.io/blinklabs/tx-submit-api
142142
subject-digest: ${{ steps.push.outputs.digest }}
143143
push-to-registry: true
144144
- name: Attest GHCR image
145-
uses: actions/attest-build-provenance@v3
145+
uses: actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4.1.0 https://github.com/actions/attest/releases/tag/v4.1.0
146146
with:
147147
subject-name: ghcr.io/${{ github.repository }}
148148
subject-digest: ${{ steps.push.outputs.digest }}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Test Issue Close Trigger
2+
permissions:
3+
contents: read
4+
on:
5+
issues:
6+
types: [closed]
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Print closed issue info
13+
env:
14+
ISSUE_NUMBER: ${{ github.event.issue.number }}
15+
ISSUE_TITLE: ${{ github.event.issue.title }}
16+
run: |
17+
echo "Issue Number: $ISSUE_NUMBER"
18+
# Prevent workflow command injection from untrusted issue titles
19+
TOKEN=$(uuidgen)
20+
echo "::stop-commands::${TOKEN}"
21+
echo "Title: $ISSUE_TITLE"
22+
echo "::${TOKEN}::"
23+
echo "Workflow triggered successfully when issue was closed."
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Set Project Closed Date
2+
3+
on:
4+
issues:
5+
types: [closed]
6+
7+
permissions:
8+
contents: read
9+
issues: read
10+
11+
env:
12+
PROJECT_URL: https://github.com/orgs/blinklabs-io/projects/11
13+
CLOSED_DATE_FIELD: "Closed Date"
14+
15+
jobs:
16+
set-date:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Resolve closed date
20+
id: when
21+
shell: bash
22+
run: |
23+
ts='${{ github.event.issue.closed_at }}'
24+
if [ -z "$ts" ] || [ "$ts" = "null" ]; then
25+
echo "Error: closed_at timestamp is missing or null. Refusing to set an incorrect closed date." >&2
26+
exit 1
27+
fi
28+
d=$(date -u -d "$ts" +%F)
29+
echo "date=$d" >> "$GITHUB_OUTPUT"
30+
echo "Closed date -> $d"
31+
32+
# Update the "Closed Date" field on that project item
33+
- name: Update Closed Date field
34+
uses: nipe0324/update-project-v2-item-field@c4af58452d1c5a788c1ea4f20e073fa722ec4a6b
35+
with:
36+
project-url: ${{ env.PROJECT_URL }}
37+
github-token: ${{ secrets.ORG_PROJECT_PAT }}
38+
field-name: ${{ env.CLOSED_DATE_FIELD }}
39+
field-value: ${{ steps.when.outputs.date }}

0 commit comments

Comments
 (0)