Skip to content

Commit 8820913

Browse files
authored
Harden CI workflows (#25)
Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent f260c97 commit 8820913

6 files changed

Lines changed: 27 additions & 31 deletions

File tree

.github/.kodiak.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ strip_html_comments = true # default: false
1515
always = true # default: false
1616

1717
[approve]
18-
auto_approve_usernames = ["1gtm", "tamalsaha"]
18+
auto_approve_usernames = ["tamalsaha", "1gtm", "1gtm-app[bot]"]

.github/workflows/ci.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,16 @@ jobs:
1919
runs-on: ubuntu-24.04
2020
steps:
2121
- name: Set up Go 1.25
22-
uses: actions/setup-go@v5
22+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
2323
with:
2424
go-version: '1.25'
2525
id: go
2626

2727
- name: Check out code into the Go module directory
28-
uses: actions/checkout@v4
28+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2929

3030
- name: Prepare Host
3131
run: |
32-
sudo apt-get -qq update || true
33-
sudo apt-get install -y bzr
3432
3533
- name: Run checks
3634
run: |

.github/workflows/release-tracker.yml

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,25 @@ concurrency:
1111

1212
jobs:
1313
build:
14+
if: github.event.pull_request.merged == true
1415
runs-on: ubuntu-24.04
1516

1617
steps:
17-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
1819

19-
- name: Prepare git
20-
env:
21-
GITHUB_USER: 1gtm
22-
GITHUB_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }}
23-
run: |
24-
git config --global user.name "${GITHUB_USER}"
25-
git config --global user.email "${GITHUB_USER}@appscode.com"
26-
git remote set-url origin https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
27-
28-
- name: Install GitHub CLI
29-
run: |
30-
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
31-
sudo mv bin/hub /usr/local/bin
20+
- name: Generate LGTM App token
21+
id: lgtm-app-token
22+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
23+
with:
24+
client-id: ${{ secrets.LGTM_APP_CLIENT_ID }}
25+
private-key: ${{ secrets.LGTM_APP_PRIVATE_KEY }}
26+
owner: ${{ github.repository_owner }}
27+
repositories: CHANGELOG
28+
permission-pull-requests: write
3229

3330
- name: Update release tracker
34-
if: |
35-
github.event.action == 'closed' &&
36-
github.event.pull_request.merged == true
3731
env:
38-
GITHUB_USER: 1gtm
39-
GITHUB_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }}
32+
GITHUB_USER: ${{ github.actor }}
33+
GITHUB_TOKEN: ${{ steps.lgtm-app-token.outputs.token }}
4034
run: |
4135
./hack/scripts/update-release-tracker.sh

.github/workflows/release.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,19 @@ jobs:
1414
build:
1515
name: Build
1616
runs-on: ubuntu-24.04
17+
permissions:
18+
contents: write
1719
steps:
1820
- name: Set up Go 1.25
19-
uses: actions/setup-go@v5
21+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
2022
with:
2123
go-version: '1.25'
2224
id: go
2325

2426
- name: Check out code into the Go module directory
25-
uses: actions/checkout@v1
27+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
28+
with:
29+
fetch-depth: 0
2630

2731
- name: Print version info
2832
id: semver
@@ -31,12 +35,12 @@ jobs:
3135
3236
- name: Set up QEMU
3337
id: qemu
34-
uses: docker/setup-qemu-action@v3
38+
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
3539
with:
3640
cache-image: false
3741

3842
- name: Set up Docker Buildx
39-
uses: docker/setup-buildx-action@v3
43+
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
4044

4145
- name: Build
4246
env:
@@ -45,7 +49,7 @@ jobs:
4549
make release COMPRESS=yes
4650
4751
- name: Release
48-
uses: softprops/action-gh-release@v1
52+
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2
4953
if: startsWith(github.ref, 'refs/tags/')
5054
with:
5155
files: |

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ COMPRESS ?= no
2121

2222
# This version-strategy uses git tags to set the version string
2323
git_branch := $(shell git rev-parse --abbrev-ref HEAD)
24-
git_tag := $(shell git describe --exact-match --abbrev=0 2>/dev/null || echo "")
24+
git_tag := $(shell git describe --tags --exact-match --abbrev=0 2>/dev/null || echo "")
2525
commit_hash := $(shell git rev-parse --verify HEAD)
2626
commit_timestamp := $(shell date --date="@$$(git show -s --format=%ct)" --utc +%FT%T)
2727

hack/scripts/update-release-tracker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ case $GITHUB_BASE_REF in
6969
;;
7070
esac
7171

72-
hub api "$api_url" -f body="$msg"
72+
gh api "$api_url" -f body="$msg"

0 commit comments

Comments
 (0)