Skip to content

Instantly share code, notes, and snippets.

@linuxdotexe
Created December 1, 2021 02:09
Show Gist options
  • Save linuxdotexe/78cda767ff3d0192f75deadc74d45749 to your computer and use it in GitHub Desktop.
Save linuxdotexe/78cda767ff3d0192f75deadc74d45749 to your computer and use it in GitHub Desktop.
My workflow for updating wallpaper previews in my nordic-wallpapers repository
name: Update previews
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get list of wallpapers
run: ls wallpapers/ > wallpaper-preview.md
- name: Add markdown syntax for image preview on each line
run: |
sed -i -e 's/^/![](wallpapers\//' wallpaper-preview.md
sed -i 's/$/\)/' wallpaper-preview.md
- name: Add heading and an empty line
run: |
sed -i '1 i\# Wallpapers in this repository' wallpaper-preview.md
sed -i '/# Wallpapers/ a \ ' wallpaper-preview.md
- name: Commit wallpaper-preview.md
uses: EndBug/add-and-commit@v7.4.0
with:
message: 'Auto updated preview'
- name: Push changes # push the output folder to your repo
run: echo 'I ran'
- uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment