-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (44 loc) · 1.47 KB
/
check_changes.yaml
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
name: Check linkedin/cruise-control updates
on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:
jobs:
check-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Get latest tag
id: latest_tag
run: |
# latest
latest_tag=$(curl -s https://api.github.com/repos/linkedin/cruise-control/tags | jq -r '.[0].name')
echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT
- name: Get current tag
id: current_tag
run: |
# current
current_tag=$(grep lastTag .lastbuild | cut -d '=' -f 2)
echo "current_tag=$current_tag" >> $GITHUB_OUTPUT
- name: Check if exists changes
id: check_changes
run: |
# check changes
if [ ${{ steps.latest_tag.outputs.latest_tag }} != ${{ steps.current_tag.outputs.current_tag }} ]; then
echo "tag_changed=true" >> $GITHUB_OUTPUT
fi
# save file
echo "lastTag=$new_tag" > .lastbuild
- name: Update .lastbuild file
if: steps.check_changes.outputs.tag_changed == 'true'
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add .lastbuild
git commit -m "chore: update lastbuid [skip ci]"
git push origin HEAD:main