Skip to content

Commit

Permalink
feat: add CI option to update external index
Browse files Browse the repository at this point in the history
  • Loading branch information
tydeu committed Dec 2, 2023
1 parent 31c71b7 commit 390301a
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions .github/workflows/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@ on:
workflow_call:
# Enable running this workflow manually from the Actions tab
workflow_dispatch:
inputs:
update-index:
description: "Upadte reservoir-index"
type: boolean
required: false
default: true

# Permit only 1 concurrent run per branch, cancelling previous ones
# Permit only 1 concurrent update of the repository
# and 1 concurrent artifact per branch, cancelling previous ones
concurrency:
group: index/${{ github.ref_name }}
group: ${{ inputs.update-index && 'index' || format('index/{0}', github.ref_name) }}
cancel-in-progress: true

jobs:
Expand All @@ -21,11 +28,31 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout Index
if: inputs.update-index
uses: actions/checkout@v3
with:
repository: leanprover/reservoir-index
path: index
- name: Query Repositories
run: ./query.py -o index.json -v -L ${{github.ref_name != 'master' && 100 || 0}}
run: |
./query.py -v \
${{ inputs.update-index && '-D index' || '-o index.json' }} \
-L ${{ (!inputs.update-index && github.ref_name != 'master') && 100 || 0 }}
env:
GH_TOKEN: ${{ github.token }}
- name: Update Index
if: inputs.update-index
uses: EndBug/add-and-commit@v9
with:
cwd: index
message: |
chore: update index
${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}/attempts/${{github.run_attempt}}
default_author: github_actions
- name: Upload Index
if: (!inputs.update-index)
uses: actions/upload-artifact@v3
with:
name: index
Expand Down

0 comments on commit 390301a

Please sign in to comment.