|
12 | 12 | current-sha: |
13 | 13 | type: string |
14 | 14 | description: 'Current SHA for build/linux/sysroot_scripts' |
15 | | - required: true |
| 15 | + required: false |
16 | 16 | upstream-sha: |
17 | 17 | type: string |
18 | 18 | description: 'Upstream SHA for build/linux/sysroot_scripts' |
19 | | - required: true |
| 19 | + required: false |
20 | 20 |
|
21 | 21 | jobs: |
22 | 22 | check-upstream-sysroot: |
23 | 23 | permissions: |
24 | 24 | issues: write |
25 | 25 | runs-on: ubuntu-latest |
| 26 | + env: |
| 27 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
26 | 28 | steps: |
| 29 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.0.2 |
27 | 30 | - name: Fetch Current SHA |
28 | 31 | shell: bash |
29 | 32 | run: | |
30 | 33 | if [ -n "${{ github.event.inputs.current-sha }}" ]; then |
31 | 34 | CURRENT_SHA="${{ github.event.inputs.current-sha }}" |
| 35 | + elif [ -f current-sha.json ]; then |
| 36 | + CURRENT_SHA=$(jq -r '.sha' current-sha.json) |
32 | 37 | 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 |
39 | 40 | fi |
40 | 41 | echo "CURRENT_SHA=${CURRENT_SHA}" >> $GITHUB_ENV |
41 | 42 | - name: Fetch latest upstream SHA |
|
44 | 45 | if [ -n "${{ github.event.inputs.upstream-sha }}" ]; then |
45 | 46 | UPSTREAM_SHA="${{ github.event.inputs.upstream-sha }}" |
46 | 47 | 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') |
48 | 49 | fi |
49 | 50 | echo "UPSTREAM_SHA=${UPSTREAM_SHA}" >> $GITHUB_ENV |
50 | 51 | - name: Compare current SHA with upstream SHA |
|
53 | 54 | if [ "${{ env.CURRENT_SHA }}" == "${{ env.UPSTREAM_SHA }}" ]; then |
54 | 55 | echo "No changes found - sysroot scripts are up to date!" |
55 | 56 | 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 |
57 | 58 |
|
58 | 59 | COMMITS=$( |
59 | 60 | jq -r --arg base_sha "${{ env.CURRENT_SHA }}" ' |
|
74 | 75 | EOF |
75 | 76 | ) |
76 | 77 |
|
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" |
85 | 79 | fi |
0 commit comments