Skip to content

Commit d8f2461

Browse files
Copilotjnsgruk
andauthored
chore: bump actions to resolve Node.js 20 deprecation warnings (#59)
* Initial plan * chore: bump actions/upload-artifact from v4 to v6 Co-authored-by: jnsgruk <668505+jnsgruk@users.noreply.github.com> Agent-Logs-Url: https://github.com/snapcrafters/ci/sessions/2f535909-0ff8-45a7-b0b9-c25d0d9b3cfe * chore: bump actions/github-script from v7 to v8 Co-authored-by: jnsgruk <668505+jnsgruk@users.noreply.github.com> Agent-Logs-Url: https://github.com/snapcrafters/ci/sessions/2f535909-0ff8-45a7-b0b9-c25d0d9b3cfe * feat: replace diddlesnaps/snapcraft-review-action with local review-snap action Co-authored-by: jnsgruk <668505+jnsgruk@users.noreply.github.com> Agent-Logs-Url: https://github.com/snapcrafters/ci/sessions/2f535909-0ff8-45a7-b0b9-c25d0d9b3cfe * feat: replace JasonEtco/create-an-issue with inline bash using gh CLI Replace the third-party JasonEtco/create-an-issue@v2 action (pinned to Node.js 20) with an inline bash step that uses yq for front-matter parsing, sed/envsubst for template rendering, and gh issue create for issue creation. All tools are pre-installed on GitHub runners. Also add test-template-render.sh for local verification of template rendering with representative environment variables. Co-authored-by: jnsgruk <668505+jnsgruk@users.noreply.github.com> Agent-Logs-Url: https://github.com/snapcrafters/ci/sessions/13d59c85-53d0-47e4-896a-de7268bf26fd * chore: remove test-template-render.sh from repo Co-authored-by: jnsgruk <668505+jnsgruk@users.noreply.github.com> Agent-Logs-Url: https://github.com/snapcrafters/ci/sessions/22aefc7a-631c-4f0c-933d-591d1e2957cd * fix: add SC2001 to shellcheck exclusions for sed with capture groups Co-authored-by: jnsgruk <668505+jnsgruk@users.noreply.github.com> Agent-Logs-Url: https://github.com/snapcrafters/ci/sessions/0154be37-ee61-4906-ad2b-ddbcb143a463 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jnsgruk <668505+jnsgruk@users.noreply.github.com>
1 parent 24e0551 commit d8f2461

11 files changed

Lines changed: 129 additions & 14 deletions

File tree

‎.github/shellcheck-actions.sh‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
55

66
export SHELLCHECK_OPTS=(
77
"-s" "bash"
8+
"-e" "2001"
89
"-e" "2296"
910
"-e" "2157"
1011
"-e" "2129"

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The actions in this repo are all used during the build, test and release of our
1212
- [snapcrafters/ci/parse-snapcraft-yaml](parse-snapcraft-yaml/README.md)
1313
- [snapcrafters/ci/promote-to-stable](promote-to-stable/README.md)
1414
- [snapcrafters/ci/release-to-candidate](release-to-candidate/README.md)
15+
- [snapcrafters/ci/review-snap](review-snap/README.md)
1516
- [snapcrafters/ci/sync-version](sync-version/README.md)
1617
- [snapcrafters/ci/test-snap-build](test-snap-build/README.md)
1718

‎call-for-testing/action.yaml‎

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ runs:
135135
awk -v r="${testing_instructions}" '{gsub(/TESTING_INSTRUCTIONS/,r)}1' template-raw.md > template.md
136136
137137
- name: Create call for testing issue
138-
uses: JasonEtco/create-an-issue@v2
139138
id: issue
139+
shell: bash
140140
env:
141141
GITHUB_TOKEN: ${{ inputs.github-token }}
142142
snap_name: ${{ steps.snapcraft-yaml.outputs.snap-name }}
@@ -145,5 +145,27 @@ runs:
145145
table: ${{ steps.build.outputs.table }}
146146
version: ${{ steps.snapcraft-yaml.outputs.version }}
147147
promotion_channel: ${{ inputs.promotion-channel }}
148-
with:
149-
filename: ./template.md
148+
run: |
149+
# Extract front-matter fields using yq
150+
title=$(yq --front-matter=extract '.title' template.md)
151+
labels=$(yq --front-matter=extract '.labels' template.md)
152+
153+
# Extract the body (everything after the closing --- of front-matter)
154+
body=$(sed '1{/^---$/!q;};1,/^---$/d' template.md)
155+
156+
# Render {{ env.VAR }} placeholders using environment variables
157+
render() {
158+
sed 's/{{ *env\.\([a-zA-Z_][a-zA-Z0-9_]*\) *}}/${\1}/g' <<< "$1" | envsubst
159+
}
160+
161+
rendered_title=$(render "$title")
162+
rendered_body=$(render "$body")
163+
164+
# Create the issue and extract the issue number from the returned URL
165+
url=$(gh issue create \
166+
--repo "$GITHUB_REPOSITORY" \
167+
--title "$rendered_title" \
168+
--label "$labels" \
169+
--body "$rendered_body")
170+
171+
echo "number=$(basename "$url")" >> "$GITHUB_OUTPUT"

‎get-screenshots/action.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ runs:
145145
echo "window=https://raw.githubusercontent.com/${{ inputs.screenshots-repo }}/main/${file_prefix}-window.png" >> "$GITHUB_OUTPUT"
146146
147147
- name: Comment on call for testing issue with screenshots
148-
uses: actions/github-script@v7
148+
uses: actions/github-script@v8
149149
with:
150150
script: |
151151
github.rest.issues.createComment({

‎promote-to-stable/action.yaml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ runs:
4343

4444
- name: Get valid revisions for promotion
4545
id: valid-revisions
46-
uses: actions/github-script@v7
46+
uses: actions/github-script@v8
4747
with:
4848
result-encoding: string
4949
script: |
@@ -124,7 +124,7 @@ runs:
124124
echo "done=$done" >> "$GITHUB_OUTPUT"
125125
126126
- name: Comment on call for testing issue
127-
uses: actions/github-script@v7
127+
uses: actions/github-script@v8
128128
with:
129129
script: |
130130
let message = ""
@@ -145,7 +145,7 @@ runs:
145145
146146
- name: Close call for testing issue
147147
if: ${{ steps.promote.outputs.done }} == "done"
148-
uses: actions/github-script@v7
148+
uses: actions/github-script@v8
149149
with:
150150
script: |
151151
if ("${{ steps.promote.outputs.done }}" === "done" && "${{ steps.promote.outputs.revisions }}".length > 0) {

‎release-to-candidate/action.yaml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,10 @@ runs:
140140
echo "architecture: ${arch}" >> "manifest-${{ inputs.architecture }}.yaml"
141141
142142
- name: Review the built snap
143-
uses: diddlesnaps/snapcraft-review-action@v1
143+
uses: snapcrafters/ci/review-snap@main
144144
with:
145145
snap: ${{ steps.build.outputs.snap }}
146-
isClassic: ${{ steps.snapcraft-yaml.outputs.classic }}
146+
is-classic: ${{ steps.snapcraft-yaml.outputs.classic }}
147147
plugs: ${{ steps.snapcraft-yaml.outputs.plugs-file }}
148148
slots: ${{ steps.snapcraft-yaml.outputs.slots-file }}
149149

@@ -175,7 +175,7 @@ runs:
175175
176176
# Upload the manifest file as an artifact for retrieval during future actions
177177
- name: Upload revision manifest
178-
uses: actions/upload-artifact@v4
178+
uses: actions/upload-artifact@v6
179179
with:
180180
name: "manifest-${{ inputs.architecture }}"
181181
path: "manifest-${{ inputs.architecture }}.yaml"

‎review-snap/README.md‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# snapcrafters/ci/review-snap
2+
3+
Reviews a built snap package using the same [review-tools] used by the Snap Store. This is a
4+
composite action replacement for [diddlesnaps/snapcraft-review-action], which is no longer
5+
maintained.
6+
7+
If you need to specify plug or slot declarations per the [review-tools] README, you can pass them
8+
using the `plugs` and `slots` inputs.
9+
10+
## Usage
11+
12+
```yaml
13+
# ...
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Review the built snap
19+
uses: snapcrafters/ci/review-snap@main
20+
with:
21+
snap: my-snap.snap
22+
```
23+
24+
## API
25+
26+
### Inputs
27+
28+
| Key | Description | Required | Default |
29+
| ------------ | ------------------------------------------------------------------- | :------: | :------ |
30+
| `is-classic` | Set this to `true` if you are reviewing a classic snap | N | |
31+
| `plugs` | The file holding plugs declarations as json to override permissions | N | |
32+
| `slots` | The file holding slots declarations as json to override permissions | N | |
33+
| `snap` | The snap file to review | Y | |
34+
35+
### Outputs
36+
37+
None
38+
39+
[review-tools]: https://snapcraft.io/review-tools
40+
[diddlesnaps/snapcraft-review-action]: https://github.com/diddlesnaps/snapcraft-review-action

‎review-snap/action.yaml‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Review Snap
2+
description: Review a built Snap package using the same tools as the Snap Store
3+
author: Snapcrafters
4+
branding:
5+
icon: check-circle
6+
color: orange
7+
8+
inputs:
9+
is-classic:
10+
description: "Set this to 'true' if you are reviewing a classic snap"
11+
required: false
12+
plugs:
13+
description: "The file holding plugs declarations as json to override default snap permissions"
14+
required: false
15+
slots:
16+
description: "The file holding slots declarations as json to override default snap permissions"
17+
required: false
18+
snap:
19+
description: "The snap file to review"
20+
required: true
21+
22+
runs:
23+
using: composite
24+
steps:
25+
- name: Install review-tools
26+
shell: bash
27+
run: |
28+
if ! snap list review-tools &>/dev/null; then
29+
sudo snap install review-tools
30+
fi
31+
32+
- name: Review the snap
33+
shell: bash
34+
env:
35+
snap_file: ${{ inputs.snap }}
36+
plugs_file: ${{ inputs.plugs }}
37+
slots_file: ${{ inputs.slots }}
38+
is_classic: ${{ inputs.is-classic }}
39+
run: |
40+
args=()
41+
if [[ -n "${plugs_file}" ]]; then
42+
args+=("--plugs" "${plugs_file}")
43+
fi
44+
if [[ -n "${slots_file}" ]]; then
45+
args+=("--slots" "${slots_file}")
46+
fi
47+
if [[ "${is_classic}" == "true" ]]; then
48+
args+=("--allow-classic")
49+
fi
50+
args+=("${snap_file}")
51+
review-tools.snap-review "${args[@]}"

‎run-tests/action.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ runs:
7777
7878
- name: Comment on call for testing issue with test result
7979
if: success() || failure()
80-
uses: actions/github-script@v7
80+
uses: actions/github-script@v8
8181
with:
8282
script: |
8383
const fs = require('node:fs');

‎test-snap-build/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ jobs:
4545
None
4646

4747
[review-tools]: https://snapcraft.io/review-tools
48-
[snapcraft-review-tools]: https://github.com/diddlesnaps/snapcraft-review-action/tree/master
48+
[snapcraft-review-tools]: https://github.com/snapcrafters/ci/tree/main/review-snap
4949
[dangerous]: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/

0 commit comments

Comments
 (0)