Skip to content

Commit 0f68f27

Browse files
committed
use artifacts instead
1 parent ef6ce9f commit 0f68f27

File tree

1 file changed

+21
-41
lines changed

1 file changed

+21
-41
lines changed

.github/workflows/dependencies.yml

Lines changed: 21 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ jobs:
2424
update:
2525
name: update dependencies
2626
runs-on: ubuntu-latest
27-
outputs:
28-
lock: ${{ steps.lock.outputs.lock }}
29-
upgrades: ${{ steps.upgrades.outputs.upgrades }}
3027
steps:
3128
- name: checkout the source code
3229
uses: actions/checkout@v3
@@ -42,31 +39,22 @@ jobs:
4239

4340
- name: cargo update
4441
run: cargo update
45-
- name: output Cargo.lock for use in PR
46-
id: lock
47-
run: |
48-
# Read Cargo.lock into an output
49-
LOCK="$(cat Cargo.lock)"
50-
# Escape LF/CR because outputs must be a single line
51-
LOCK="${LOCK//'%'/'%25'}"
52-
LOCK="${LOCK//$'\n'/'%0A'}"
53-
LOCK="${LOCK//$'\r'/'%0D'}"
54-
echo "lock=${LOCK}" >> "$GITHUB_OUTPUT"
42+
- name: upload Cargo.lock artifact for use in PR
43+
uses: actions/upload-artifact@v3
44+
with:
45+
name: Cargo-lock
46+
path: Cargo.lock
47+
retention-days: 1
5548

5649
- name: cargo upgrades
5750
# cargo-upgrade exits 7 if upgrades are available, ignore that
5851
run: cargo upgrades > cargo_upgrades.stdout || exit 0
5952
- name: output upgrades for use in PR
60-
id: upgrades
61-
run: |
62-
# Read cargo_upgrades.stdout into an output
63-
# Convert absolute paths to relative paths
64-
UPGRADES="$(sed "s#$(pwd)/##" cargo_upgrades.stdout)"
65-
# Escape LF/CR because outputs must be a single line
66-
UPGRADES="${UPGRADES//'%'/'%25'}"
67-
UPGRADES="${UPGRADES//$'\n'/'%0A'}"
68-
UPGRADES="${UPGRADES//$'\r'/'%0D'}"
69-
echo "upgrades=${UPGRADES}" >> "$GITHUB_OUTPUT"
53+
uses: actions/upload-artifact@v3
54+
with:
55+
name: cargo-upgrades
56+
path: cargo-upgrades.stdout
57+
retention-days: 1
7058

7159
pr:
7260
name: amend PR
@@ -79,28 +67,20 @@ jobs:
7967
- name: checkout the source code
8068
uses: actions/checkout@v3
8169

82-
- name: get Cargo.lock from update job
83-
env:
84-
LOCK: ${{ needs.update.outputs.lock }}
85-
run: |
86-
# Un-escape
87-
LOCK="${LOCK//'%0D'/$'\r'}"
88-
LOCK="${LOCK//'%0A'/$'\n'}"
89-
LOCK="${LOCK//'%25'/'%'}"
90-
# Write to file
91-
echo "${LOCK}" > Cargo.lock
70+
- name: download Cargo.lock from update job
71+
uses: actions/download-artifact@v3
72+
with:
73+
name: Cargo-lock
74+
- name: download cargo-upgrades from update job
75+
uses: actions/download-artifact@v3
76+
with:
77+
name: cargo-upgrades
78+
9279
- name: craft PR body
93-
env:
94-
UPGRADES: ${{ needs.update.outputs.upgrades }}
9580
run: |
96-
# Un-escape
97-
UPGRADES="${UPGRADES//'%0D'/$'\r'}"
98-
UPGRADES="${UPGRADES//'%0A'/$'\n'}"
99-
UPGRADES="${UPGRADES//'%25'/'%'}"
100-
10181
echo "${PR_MESSAGE}" > body.md
10282
echo '```txt' >> body.md
103-
echo "${UPGRADES}" >> body.md
83+
cat cargo-upgrades.stdout >> body.md
10484
echo '```' >> body.md
10585
10686
- name: edit and reopen existing pull request

0 commit comments

Comments
 (0)