Skip to content

Commit

Permalink
also push to hydro template
Browse files Browse the repository at this point in the history
  • Loading branch information
MingweiSamuel committed Dec 23, 2024
1 parent 1434f0f commit 15816a8
Showing 1 changed file with 46 additions and 3 deletions.
49 changes: 46 additions & 3 deletions .github/workflows/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,56 @@ jobs:
args: --manifest-path "${{ runner.temp }}/generated/Cargo.toml" --all-targets

push_dfir:
name: Push dfir repo
name: Push to dfir template repo
needs: test_dfir
if: ${{ needs.test_dfir.result == 'success' && github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
env:
DIR: template/dfir
REPO: dfir-template
runs-on: ubuntu-latest

steps:
- name: Generate token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: |
${{ github.event.repository.name }}
${{ env.REPO }}
- name: Checkout main repo
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}

- name: Push to template repo
shell: bash
run: |
git -C "$DIR" init -q
git -C "$DIR" remote add origin "https://github.com/${{ github.repository_owner }}/${{ env.REPO }}.git"
git -C "$DIR" config credential.helper "$(git config credential.helper)"
git -C "$DIR" config 'http.https://github.com/.extraheader' "$(git config 'http.https://github.com/.extraheader')"
git -C "$DIR" config core.autocrlf input
git -C "$DIR" config core.safecrlf false
git -C "$DIR" config user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git -C "$DIR" config user.email "$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)[bot]@users.noreply.github.com"
git -C "$DIR" add -A
git -C "$DIR" commit -m "Update template $(date -I) $(git rev-parse HEAD)"
git -C "$DIR" push -f -u origin HEAD:main --quiet
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}

push_hydro_lang:
name: Push to hydro template repo
needs: test_hydro_lang
if: ${{ needs.test_hydro_lang.result == 'success' && github.event_name != 'pull_request' }}
env:
DIR: template/hydro
REPO: hydro-template
runs-on: ubuntu-latest

steps:
- name: Generate token
Expand All @@ -179,7 +222,7 @@ jobs:
with:
token: ${{ steps.app-token.outputs.token }}

- name: Push to dfir repo
- name: Push to template repo
shell: bash
run: |
git -C "$DIR" init -q
Expand Down

0 comments on commit 15816a8

Please sign in to comment.