|
| 1 | +name: Check Upstream Sysroot Updates |
| 2 | + |
| 3 | +description: | |
| 4 | + This workflow runs every two weeks, checks our sysroot scripts against Chromium's |
| 5 | + at build/linux/sysroot_scripts and opens an issue if there are any new changes. |
| 6 | +
|
| 7 | +on: |
| 8 | + schedule: |
| 9 | + - cron: "0 0 1,15 * *" |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + current-sha: |
| 13 | + type: string |
| 14 | + description: 'Current SHA for build/linux/sysroot_scripts' |
| 15 | + required: false |
| 16 | + upstream-sha: |
| 17 | + type: string |
| 18 | + description: 'Upstream SHA for build/linux/sysroot_scripts' |
| 19 | + required: false |
| 20 | + |
| 21 | +jobs: |
| 22 | + check-upstream-sysroot: |
| 23 | + permissions: |
| 24 | + issues: write |
| 25 | + runs-on: ubuntu-latest |
| 26 | + env: |
| 27 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 30 | + - name: Fetch Current SHA |
| 31 | + shell: bash |
| 32 | + run: | |
| 33 | + if [ -n "${{ github.event.inputs.current-sha }}" ]; then |
| 34 | + CURRENT_SHA="${{ github.event.inputs.current-sha }}" |
| 35 | + elif [ -f current-sha.json ]; then |
| 36 | + CURRENT_SHA=$(jq -r '.sha' current-sha.json) |
| 37 | + else |
| 38 | + echo "No current SHA provided and current-sha.json not found." |
| 39 | + exit 1 |
| 40 | + fi |
| 41 | + echo "CURRENT_SHA=${CURRENT_SHA}" >> $GITHUB_ENV |
| 42 | + - name: Fetch latest upstream SHA |
| 43 | + shell: bash |
| 44 | + run: | |
| 45 | + if [ -n "${{ github.event.inputs.upstream-sha }}" ]; then |
| 46 | + UPSTREAM_SHA="${{ github.event.inputs.upstream-sha }}" |
| 47 | + else |
| 48 | + UPSTREAM_SHA=$(gh api -X GET repos/chromium/chromium/commits -f path="build/linux/sysroot_scripts" -f per_page=1 --jq '.[0].sha') |
| 49 | + fi |
| 50 | + echo "UPSTREAM_SHA=${UPSTREAM_SHA}" >> $GITHUB_ENV |
| 51 | + - name: Compare current SHA with upstream SHA |
| 52 | + shell: bash |
| 53 | + run: | |
| 54 | + if [ "${{ env.CURRENT_SHA }}" == "${{ env.UPSTREAM_SHA }}" ]; then |
| 55 | + echo "No changes found - sysroot scripts are up to date!" |
| 56 | + else |
| 57 | + gh api -X GET repos/chromium/chromium/commits -f path="build/linux/sysroot_scripts" -f per_page=20 > commits.json |
| 58 | +
|
| 59 | + COMMITS=$( |
| 60 | + jq -r --arg base_sha "${{ env.CURRENT_SHA }}" ' |
| 61 | + ([.[].sha] | index($base_sha) // length) as $idx | |
| 62 | + .[0:$idx] | .[] | |
| 63 | + "- [`\(.sha[0:7])`](\(.html_url)) \(.commit.message | split("\n")[0])" |
| 64 | + ' commits.json |
| 65 | + ) |
| 66 | +
|
| 67 | + if [ -z "$COMMITS" ]; then |
| 68 | + echo "No new commits found." |
| 69 | + exit 0 |
| 70 | + fi |
| 71 | +
|
| 72 | + ISSUE_BODY=$(cat <<EOF |
| 73 | + ### Upstream sysroot scripts have been updated |
| 74 | +
|
| 75 | + Commits between \`${CURRENT_SHA:0:7}\` and \`${UPSTREAM_SHA:0:7}\`: |
| 76 | +
|
| 77 | + ${COMMITS} |
| 78 | +
|
| 79 | + @electron/wg-upgrades please review these changes and update our scripts accordingly. |
| 80 | + EOF |
| 81 | + ) |
| 82 | +
|
| 83 | + gh issue create --title "Upstream sysroot scripts have changed" --body="$ISSUE_BODY" |
| 84 | + fi |
0 commit comments