does anyone have a way of getting the last green c...
# general
p
does anyone have a way of getting the last green commit for github actions they like? I found this, but the issues indicate it gets the last CL with any green workflows
I got some GitHub api shell nonsense working to do this, not sure if there's a more standard way
w
Would you mind sharing the api shell nonsense version? I was looking for something similar to work out a —changed-since revision for main
p
I'll share it once I've tested it more thoroughly, it's already needed a rewrite and several patches since yesterday lol
@witty-agent-59418 Here is the reduced yaml you need for this to work:
Copy code
name: Pants

on: push

permissions:
  actions: read  # Allows reading workflow runs
  contents: read  # Allows reading repository contents
  statuses: read  # Allows reading commit statuses

jobs:
  build:
    steps:
    - uses: actions/checkout@v4
      with:
        fetch-depth: 0
    - name: Find last green commit
      id: find_commit
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: |
        chmod +x ./tools/green.sh
        ./tools/green.sh
    - name: Lint
      run: |
        pants --changed-since=${{ steps.find_commit.outputs.last_green_commit }} lint
And I have attached the shell script
w
Thanks Alex!