| name: Test | |
| # Temporary test workflow | |
| on: | |
| workflow_dispatch: | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| # Actions is needed for gh run download | |
| permissions: | |
| contents: read | |
| # pages: write | |
| # id-token: write | |
| actions: read | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # - name: Checkout source | |
| # uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Check which is latest usable artifact | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| export | grep 'GITHUB_.*REF' | |
| gh api /repos/$GITHUB_REPOSITORY/actions/artifacts | tee artifacts.json | |
| # Extract required parts | |
| jq <artifacts.json '.artifacts[]|"\(.created_at) \(.name) \(.workflow_run.head_branch) \(.expires_at)"' | tee extract.txt | |
| # ensure artifact comes from this branch | |
| grep " github-pages $GITHUB_REF_NAME \| generated-site $GITHUB_REF_NAME " extract.txt | sort -r | head -1 | cut -d' ' -f 2 |