diff --git a/.forgejo/workflows/daily-collect.yaml b/.forgejo/workflows/daily-collect.yaml index bafcc5f..6b39453 100644 --- a/.forgejo/workflows/daily-collect.yaml +++ b/.forgejo/workflows/daily-collect.yaml @@ -3,55 +3,51 @@ on: schedule: - cron: '0 1 * * *' workflow_dispatch: - permissions: contents: write - jobs: update-feed: runs-on: ubuntu-latest container: - image: node:18 + image: node:18 steps: - - name: Git Setup - run: | - mkdir -p ~/.ssh - echo 'Host git.mcdevitt.tech' >> ~/.ssh/config - echo ' HostName git.mcdevitt.tech' >> ~/.ssh/config - echo ' User git' >> ~/.ssh/config - echo ' Port 3022' >> ~/.ssh/config - cat ~/.ssh/config - - name: Checkout repository uses: actions/checkout@v4 with: - repository: bpmcdevitt/github_poc_collector - # Use the appropriate ref if you want a specific branch/commit - # ref: main - # If you need to use SSH - #ssh-key: ${{ secrets.TOKEN_NAME }} - # If you have specific known hosts - #ssh-known-hosts: 'git.mcdevitt.tech' - #ssh-strict: 'false' - github-server-url: 'https://git.mcdevitt.tech' + server-url: 'https://git.mcdevitt.tech' + repository: 'bpmcdevitt/github_poc_collector' + + - name: Setup SSH + env: + SSH_PRIVATE_KEY: ${{ secrets.TOKEN_NAME }} + run: | + mkdir -p ~/.ssh + ssh-keyscan -p 3022 git.mcdevitt.tech >> ~/.ssh/known_hosts + echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa - name: Setup Rust run: | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - source "$HOME/.cargo/env" + [ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env" + export PATH="$HOME/.cargo/bin:$PATH" rustup default stable rustc --version cargo --version - name: Cache Cargo dependencies - run: | - mkdir -p ~/.cargo/registry - mkdir -p ~/.cargo/git - mkdir -p target + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Run recent feed update run: | - source "$HOME/.cargo/env" + [ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env" + export PATH="$HOME/.cargo/bin:$PATH" cargo run -- --feed recent - name: Commit and push results @@ -60,4 +56,4 @@ jobs: git config user.email brendan@mcdevitt.tech git add . git commit -m "Update recent feed data" || exit 0 - git push + git push origin main