Skip to content

Commit c84a35e

Browse files
committed
chore: feedback from review
1 parent 9d01344 commit c84a35e

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

.github/workflows/upstream-sysroot.yml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,31 @@ on:
1212
current-sha:
1313
type: string
1414
description: 'Current SHA for build/linux/sysroot_scripts'
15-
required: true
15+
required: false
1616
upstream-sha:
1717
type: string
1818
description: 'Upstream SHA for build/linux/sysroot_scripts'
19-
required: true
19+
required: false
2020

2121
jobs:
2222
check-upstream-sysroot:
2323
permissions:
2424
issues: write
2525
runs-on: ubuntu-latest
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2628
steps:
29+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.0.2
2730
- name: Fetch Current SHA
2831
shell: bash
2932
run: |
3033
if [ -n "${{ github.event.inputs.current-sha }}" ]; then
3134
CURRENT_SHA="${{ github.event.inputs.current-sha }}"
35+
elif [ -f current-sha.json ]; then
36+
CURRENT_SHA=$(jq -r '.sha' current-sha.json)
3237
else
33-
if [ -f current-sha.json ]; then
34-
CURRENT_SHA=$(jq -r '.sha' current-sha.json)
35-
else
36-
echo "No current SHA provided and current-sha.json not found."
37-
exit 1
38-
fi
38+
echo "No current SHA provided and current-sha.json not found."
39+
exit 1
3940
fi
4041
echo "CURRENT_SHA=${CURRENT_SHA}" >> $GITHUB_ENV
4142
- name: Fetch latest upstream SHA
@@ -44,7 +45,7 @@ jobs:
4445
if [ -n "${{ github.event.inputs.upstream-sha }}" ]; then
4546
UPSTREAM_SHA="${{ github.event.inputs.upstream-sha }}"
4647
else
47-
UPSTREAM_SHA=$(curl -s "https://api.github.com/repos/chromium/chromium/commits?path=build/linux/sysroot_scripts&per_page=1" | jq -r '.[0].sha')
48+
UPSTREAM_SHA=$(gh api -X GET repos/chromium/chromium/commits -f path="build/linux/sysroot_scripts" -f per_page=1 --jq '.[0].sha')
4849
fi
4950
echo "UPSTREAM_SHA=${UPSTREAM_SHA}" >> $GITHUB_ENV
5051
- name: Compare current SHA with upstream SHA
@@ -53,7 +54,7 @@ jobs:
5354
if [ "${{ env.CURRENT_SHA }}" == "${{ env.UPSTREAM_SHA }}" ]; then
5455
echo "No changes found - sysroot scripts are up to date!"
5556
else
56-
curl -s "https://api.github.com/repos/chromium/chromium/commits?path=build/linux/sysroot_scripts&per_page=20" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" > commits.json
57+
gh api -X GET repos/chromium/chromium/commits -f path="build/linux/sysroot_scripts" -f per_page=20 > commits.json
5758
5859
COMMITS=$(
5960
jq -r --arg base_sha "${{ env.CURRENT_SHA }}" '
@@ -74,12 +75,5 @@ jobs:
7475
EOF
7576
)
7677
77-
BODY_JSON=$(jq -n --arg body "$ISSUE_BODY" --arg title "Upstream sysroot scripts have changed" '{title: $title, body: $body}')
78-
79-
curl -X POST \
80-
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
81-
-H "Accept: application/vnd.github.v3+json" \
82-
-H "Content-Type: application/json" \
83-
-d "$BODY_JSON" \
84-
"https://api.github.com/repos/${{ github.repository }}/issues"
78+
gh issue create --title "Upstream sysroot scripts have changed" --body="$ISSUE_BODY"
8579
fi

0 commit comments

Comments
 (0)