trapd00r/LS_COLORS

Fix github action logic

rpdelaney opened this issue · 7 comments

We're getting build failures from the new GitHub actions. See #184

cc @ahmedelgabri

Might be that it needs this, but I also have a similar workflow working without the token so I'm a bit confused.

It's already set by GitHub automatically https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow

Could you try adding this to this section

- name: 'Commit generated files'
if: ${{ success() }}
run: |
git config user.name 'github-actions'
git config user.email 'github-actions@github.com'
git add lscolors.sh lscolors.csh
git commit -m "Update shell files" || echo "No changes to commit"
git push

env:
  GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'

I might try testing this in a fork to avoid disruption downstream. I have a lot on my plate right now but hopefully I can get to it soon. The first task will be to reproduce the failure in a fork.

Another solution is to avoid all this logic to detect a merged PR, since there is no real official way to do it. And instead, run the action on push but only on master which will be triggered also when a PR is merged to master

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 8b4405e..f0f410d 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,12 +1,10 @@
 name: 'Release'
 on:
-  pull_request:
+  push:
     branches: [master]
-    types: [closed]
 
 jobs:
   release:
-    if: github.event.pull_request.merged == true
     runs-on: ubuntu-latest
     steps:
       - name: 'Check out Git repository'

@ahmedelgabri I've been very busy with trying to close on a house. Would you be willing to send a pull request with the fix? I just have not been able to make time. :(

@rpdelaney can you have a look at #186?

Did that work?

Edit: seems like lscolors.sh wasn't rebuilt

@rpdelaney that's because the only change that happened to the source code was #183 which generated a correct .csh file. The .sh files didn't change, so only .csh was rebuilt.

https://github.com/trapd00r/LS_COLORS/commits/master

Makes sense. Looks good now: 5608c10

Thanks again!