Skip to content

Commit

Permalink
feat: semantic versions + ErrParseMasterSID
Browse files Browse the repository at this point in the history
  • Loading branch information
Gornak40 committed Dec 29, 2023
1 parent 700ab2a commit b7ce434
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.21'

- name: Build
run: make build
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release
on:
push:
branches:
- master

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Release
uses: codfish/semantic-release-action@v2.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
branches:
- name: "master"

plugins:
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- "@semantic-release/GitHub"
7 changes: 7 additions & 0 deletions ejudge/ejudge.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import (

const BadSID = "0000000000000000"

var (
ErrParseMasterSID = fmt.Errorf("can't parse master SID")
)

type Config struct {
URL string `json:"url"`
Login string `json:"login"`
Expand Down Expand Up @@ -137,6 +141,9 @@ func (ej *Ejudge) ReloadConfig(sid string, cid int) error {
return err
}
csid := req.URL.Query().Get("SID")
if csid == "" {
return ErrParseMasterSID
}
logrus.WithFields(logrus.Fields{"CID": cid, "CSID": csid, "SID": sid}).Info("success master login")
_, _, err = ej.postRequest("new-master", url.Values{
"SID": {csid},
Expand Down

0 comments on commit b7ce434

Please sign in to comment.