'Github Action in limbo after setting required statuses
I have 3 workflows I'm using for my Github repo that I'm trying to get to work, but keep falling into a stalemate after one of the actions completes.
I have the following actions:
- markdown linter
- image compressor
- publish to gh-pages
I also have the markdown linter and the image compressor as required statuses since I don't want ill-formatted or uncompressed images to be pushed to the live Github pages.
Unfortunately, what I'm encountering at the moment is, the linter checks and passes, then the image compressor runs and adds to the current PR the updated images. But then because its updated the linter is sitting idle with no way to merge.
The script:
name: Safe merging workflow
on:
pull_request:
jobs:
job1:
name: "Markdown Linter"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Markdown Lint
uses: ruzickap/action-my-markdown-linter@v1
job2:
name: "Image Compression"
needs: job1
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Compress Images
uses: calibreapp/image-actions@main
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
Is there any way I can run this so:
- if the linter passes, the images are compressed, and then the user can merge
- if the linter passes, and there are no images to compress then the user can merge
- if the linter fails, the images don't get compressed
Solution 1:[1]
You need to re-run the linter every time your PR is synchronized with new commits. The following step is the next step after you've already committed the compressed image.
name: Safe merging workflow
on:
pull_request:
types:
- opened
- synchronize
jobs:
job1:
name: "Markdown Linter"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Markdown Lint
uses: ruzickap/action-my-markdown-linter@v1
job2:
name: "Image Compression"
needs: job1
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Compress Images
uses: calibreapp/image-actions@main
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | vsr |
