Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github Action #9

Open
allanpersson opened this issue Nov 20, 2019 · 4 comments
Open

Github Action #9

allanpersson opened this issue Nov 20, 2019 · 4 comments
Labels
help wanted Extra attention is needed invalid This doesn't seem right

Comments

@allanpersson
Copy link
Owner

allanpersson commented Nov 20, 2019

Describe the bug
Need help with the script for the following in my github action.

Trigger

Jsonlint

Shellcheck

Esphome stable / Beta / Dev:

  • Esphome version
  • Esphome check

My Workflow file:
https://github.com/allanpersson/home-assistant-config/blob/master/.github/workflows/home-assistant.yml

The rest of the workflow file is working :)

Documentation:

@allanpersson allanpersson added help wanted Extra attention is needed invalid This doesn't seem right labels Nov 20, 2019
@foreign-sub
Copy link

foreign-sub commented Dec 12, 2019

Hi allan,

for the trigger it seems to me you can do something like:

on:
  release:
    types: published

for your other jobs, your job currently fails with:

jsonlint:
find: unrecognized: |

spellcheck:

/entrypoint.sh: exec: line 13: -: not found
##[error]Docker run failed with exit code 127

looks like your entrypoint.sh script does not like the "-" in your config file

esphome:
`esphome: error: argument command: invalid choice: 'python' (choose from 'config', 'compile', 'upload', 'logs', 'run', 'clean-mqtt', 'wizard', 'mqtt-fingerprint', 'version', 'clean', 'dashboard', 'vscode', 'update-all')

so all of them have args syntax issues.

@allanpersson
Copy link
Owner Author

allanpersson commented Dec 12, 2019

Thanks for your help and input :)

From the Github forum i got an answer that its not possible to trigger from updates in other peoples repo, but i have tried to update the workflow with your suggestion to see what happens :)

for the trigger it seems to me you can do something like:

on:
  release:
    types: published

I'm not sure exactly what i have to change?

for your other jobs, your job currently fails with:

jsonlint:
find: unrecognized: |

spellcheck:

/entrypoint.sh: exec: line 13: -: not found
##[error]Docker run failed with exit code 127

looks like your entrypoint.sh script does not like the "-" in your config file

I know :) But i don't know what arg i need to use to make it work, i honestly dont understand how this works, i have just copied from other persons workflow to come so far :D

esphome:
`esphome: error: argument command: invalid choice: 'python' (choose from 'config', 'compile', 'upload', 'logs', 'run', 'clean-mqtt', 'wizard', 'mqtt-fingerprint', 'version', 'clean', 'dashboard', 'vscode', 'update-all')

so all of them have args syntax issues.

@foreign-sub
Copy link

foreign-sub commented Dec 12, 2019

From the Github forum i got an answer that its not possible to trigger from updates in other peoples repo, but i have tried to update the workflow with your suggestion to see what happens :)

You're right this won't work anyway because of this restriction, btw you can totally remove:

- "home-assistant/home-assistant/releases/tag/*"

so you're left with:

on:
  schedule:
    - cron: '* 23 * * *'

not realtime but once a day should be enough,

then for the args syntax you can start by removing the offending chars and see how it goes.

@foreign-sub
Copy link

So you can not do it with a single action, but there seems to be a way to do it using an other action to trigger the first one, see:

Trigger a GitHub Action when another repository creates a new release

name: Get HA latest release version
on:
  schedule:
    - cron:  '0 10 * * *'
jobs:
  get-version:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Fetch release version
        run: |
          curl -sL https://api.github.com/repos/home-assistant/home-assistant/releases/latest | \
          jq -r ".tag_name" > release-versions/home-assistant-latest.txt
      - name: Check for modified files
        id: git-check
        run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)
      - name: Commit latest release version
        if: steps.git-check.outputs.modified == 'true'
        run: |
          git config --global user.name 'allanpersson'
          git config --global user.email '[email protected]'
          git remote set-url origin https://x-access-token:${{ secrets.REPO_SCOPED_TOKEN }}@github.com/$GITHUB_REPOSITORY
          git checkout "${GITHUB_REF:11}"
          git commit -am "New release version"
          git push

then you trigger on:

on:
  push:
    paths:
      - 'release-versions/*'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants