Skip to content

Commit

Permalink
hack: Init github action cron for updating issue
Browse files Browse the repository at this point in the history
- just test if cron got triggered properly, the go code simply echo and
exit and does not do anything to issue
  • Loading branch information
at15 committed Feb 18, 2020
1 parent 8fbf880 commit a87c23d
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
201*
2020
docs
.github
.jekyll
16 changes: 16 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Workflow for dyweb weekly

GitHub workflow does the following things

- create a new issue every week
- close old issues when creating new issues
- generate new weekly markdown file and push to master
- generate new html? (not sure if it is really needed)

## TODO

- multiple workflow yaml

## Reference

- [cron](https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule)
16 changes: 16 additions & 0 deletions .github/workflows/issue.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# create a new issue every week
# FIXME(at15): it is coded to every 5 minutes to have test if things are working

on:
schedule:
- cron: '*/5 * * * *'

job:
create:
runs-on: ubuntu-latest
name: create new weekly issue
steps:
- name: Checkout
uses: actions/checkout@v2
- name: new issue
uses: ./ # Uses action in the root directory
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# https://steele.blue/tiny-github-actions/
FROM dyweb/go-dev:1.13.6 as builder

LABEL maintainer="[email protected]"

ARG PROJECT_ROOT=/go/src/github.com/dyweb/weekly

WORKDIR $PROJECT_ROOT

COPY . $PROJECT_ROOT
RUN cd scripts/weekly && go install .

FROM ubuntu:18.04
LABEL maintainer="[email protected]"
WORKDIR /usr/bin
COPY --from=builder /go/bin/weekly .
ENTRYPOINT ["weekly"]
CMD ["help"]
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: 'weekly'
description: 'Create new weekly issue, run weekly generator'
runs:
using: 'docker'
image: 'Dockerfile'
# TODO: allow passing arguments from workflow
args:
- foo
3 changes: 3 additions & 0 deletions scripts/weekly/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/dyweb/weekly/scripts/weekly

go 1.13
12 changes: 12 additions & 0 deletions scripts/weekly/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package main

import (
"fmt"
"os"
)

// TODO: create github client, port code from https://github.com/dyweb/dy-bot/blob/master/pkg/weekly/worker.go

func main() {
fmt.Printf("weekly args %v\n", os.Args)
}

0 comments on commit a87c23d

Please sign in to comment.