Skip to content

Commit

Permalink
Automate repository update
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Dec 22, 2023
1 parent 00ce000 commit 55de1ea
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/workflows/repositories.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: update-repositories
on:
schedule:
# Every Monday at 01:07 UTC
- cron: "07 01 * * MON"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@latest
with:
version: '1'
- uses: actions/checkout@v1
- name: Install
run: julia --project=. -e 'import Pkg; Pkg.instantiate()'
- name: Repositories
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: julia --project=. scripts/repositories.jl --update
- name: push
if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule'
run: |
git config --global user.email "odow@users.noreply.github.com"
git config --global user.name "Oscar Dowson"
git add .
git commit -m "Automatic update script."
git push
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
7 changes: 6 additions & 1 deletion scripts/repositories.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ function Repository(repo; since, until, my_auth)
end

function get_repos(since, until)
my_auth = GitHub.authenticate(ENV["PERSONAL_ACCESS_TOKEN"])
token = if haskey(ENV, "PERSONAL_ACCESS_TOKEN")
ENV["PERSONAL_ACCESS_TOKEN"]
else
ENV["GITHUB_TOKEN"]
end
my_auth = GitHub.authenticate(token)
all_repos, _ = GitHub.repos("jump-dev", auth = my_auth)
return Dict(
repo => Repository(
Expand Down

0 comments on commit 55de1ea

Please sign in to comment.