Compare commits
3 commits
Author | SHA1 | Date | |
---|---|---|---|
99eef916b4 | |||
75bd20c775 | |||
1a93593ca0 |
4 changed files with 18 additions and 5 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1 +1,5 @@
|
|||
/.idea/
|
||||
/check
|
||||
/debian-dsa
|
||||
/in
|
||||
/out
|
||||
|
|
|
@ -65,11 +65,11 @@ shortened and pretty-printed example output looks like this:
|
|||
[
|
||||
{
|
||||
"date": "2023-01-18",
|
||||
"title": "DSA-5322"
|
||||
"dsa": "DSA-5322"
|
||||
},
|
||||
{
|
||||
"date": "2023-01-19",
|
||||
"title": "DSA-5323"
|
||||
"dsa": "DSA-5323"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
@ -87,7 +87,7 @@ metadata. If the version exists. The following input example returns the output
|
|||
"params": {},
|
||||
"version": {
|
||||
"date": "2023-01-18",
|
||||
"title": "DSA-5322"
|
||||
"dsa": "DSA-5322"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
BIN
debian-dsa
BIN
debian-dsa
Binary file not shown.
|
@ -147,8 +147,10 @@ func (r *Resource) Check() error {
|
|||
return fmt.Errorf("could not parse input from Concourse: %w", err)
|
||||
}
|
||||
|
||||
var inputDate time.Time
|
||||
|
||||
if len(input.Version.Date) > 0 {
|
||||
_, err = parseISODate(input.Version.Date)
|
||||
inputDate, err = parseISODate(input.Version.Date)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not interpret version from Concourse as date: %w", err)
|
||||
}
|
||||
|
@ -164,8 +166,15 @@ func (r *Resource) Check() error {
|
|||
for _, item := range dsaData.Items {
|
||||
parts := strings.SplitN(item.Title, " ", 2)
|
||||
|
||||
versionDate, err := parseISODate(item.Date)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not interpret date from RDF feed as date: %w", err)
|
||||
}
|
||||
|
||||
if inputDate.IsZero() || inputDate.Before(versionDate) {
|
||||
dates.addVersion(Version{Date: item.Date, DSANumber: parts[0]})
|
||||
}
|
||||
}
|
||||
|
||||
sort.Sort(dates)
|
||||
|
||||
|
|
Loading…
Reference in a new issue