Skip to content

Commit

Permalink
Add demo action for actions/checkout #1782
Browse files Browse the repository at this point in the history
  • Loading branch information
oxc committed Jul 15, 2024
0 parents commit e0d5336
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Demo for non-standard ref names issue

on:
workflow_dispatch:

jobs:
push_ref:
name: Create non-standard ref name
runs-on: ubuntu-latest
outputs:
ref: ${{ steps.push.outputs.ref }}

permissions:
contents: write

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Create dummy commit, and push as non-standard ref
id: push
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
echo "Dummy" > dummy
git add dummy
git commit -m 'Dummy commit (run id ${{ github.run_id }})'
git push origin HEAD:$REF
echo "ref=$REF" >> "$GITHUB_OUTPUT"
env:
REF: "refs/deploy-bot/${{ github.run_id }}/merge"

checkout_old_working:
name: Checkout non-standard ref name (working @4.1.6)
runs-on: ubuntu-latest
needs: push_ref

steps:
- name: Checkout repo
uses: actions/checkout@v4.1.6
with:
ref: ${{ needs.push_ref.outputs.ref }}

- name: Show latest commit
run: |
git log -1
cat dummy
checkout_new_failing:
name: Checkout non-standard ref name (failing @ > 4.1.6)
runs-on: ubuntu-latest
needs: push_ref

steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ needs.push_ref.outputs.ref }}

- name: Show latest commit
run: |
git log -1
cat dummy

0 comments on commit e0d5336

Please sign in to comment.