forked from chipsalliance/chisel
-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (80 loc) · 2.76 KB
/
enable-bincompat-checking.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Enable Binary Compatibility Checking
on:
release:
types: [created]
workflow_dispatch:
inputs:
version:
description: 'Version for which to enable binary compatibility checking'
require: true
permissions:
pull-requests: write
contents: write
jobs:
determine_version:
name: Determine Version
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.dowork.outputs.version }}
steps:
- id: dowork
run: |
if [[ -z "${{ inputs.version }}" ]]; then
echo "version=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
else
echo "version=${{ inputs.version }}" >> "$GITHUB_OUTPUT"
fi
determine_branches:
name: Determine Branches
runs-on: ubuntu-22.04
needs: [determine_version]
outputs:
branches: ${{ steps.determine-branches.outputs.branches }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check Valid
run: |
VERSION=${{ needs.determine_version.outputs.version }}
if git rev-parse $VERSION; then
echo "Valid version!"
else
echo "$VERSION is not an existing tag!" >> $GITHUB_STEP_SUMMARY
exit 1
fi
- id: determine-branches
run: |
VERSION=${{ needs.determine_version.outputs.version }}
touch branches.txt
STABLE=$(git for-each-ref --format='%(refname:short)' refs/remotes/origin/*.x)
for branch in $STABLE origin/main; do
if git merge-base --is-ancestor $VERSION $branch; then
echo ${branch#origin/} >> branches.txt
fi
done
echo "branches=$(jq -ncR [inputs] branches.txt)" >> "$GITHUB_OUTPUT"
open_prs:
name: Open Pull Requests
runs-on: ubuntu-22.04
needs: [determine_version, determine_branches]
strategy:
matrix:
branch: ${{ fromJson(needs.determine_branches.outputs.branches) }}
steps:
- uses: actions/checkout@v3
- name: Create file
run: |
VERSION=${{ needs.determine_version.outputs.version }}
VERSION_NO_V=${VERSION#v}
echo $VERSION_NO_V >> project/previous-versions.txt
- name: Open PR
uses: peter-evans/create-pull-request@v5
with:
base: ${{ matrix.branch }}
branch: bincompat/${{ matrix.branch }}/${{ needs.determine_version.outputs.version }}
title: "[${{ matrix.branch }}] Enable MiMa for ${{ needs.determine_version.outputs.version }}"
commit-message: "Enable MiMa for ${{ needs.determine_version.outputs.version }}"
body: "Enable MiMa for ${{ needs.determine_version.outputs.version }}"
labels: Internal
token: ${{ secrets.CHISEL_BOT_TOKEN }}