I have a Github page that automatically gets updated when I push to master. I would like to run a Github action that would trigger when the website gets published.
This would allow me to get the updated RSS feed and update my social media accounts anytime I push a change to the website.
Is it possible to run a Github action when the website changes and after it is published?
Or is it possible to turn off the GitHub page publishing and create a workflow that I have control of and publish myself?
GitHub Pages uses deployments to publish. The following workflow will trigger when a deployment was successful allowing you to update what you need to afterwards.
on: deployment_status
jobs:
publish:
if: github.event.deployment_status.state == 'success'
runs-on: ubuntu-latest
steps:
...
Related
We have a GitHub Actions workflow triggered by the creation of a release, i.e.,
on:
release:
types: [created]
How can we add the built files to the triggereing release as an asset from within the workflow?
I have seen this answer recommending softprops/action-gh-release, but that seems to apply to workflows triggered by pushes (with tags) and not "on release".
You can use the same action with the on: release trigger.
The GITHUB_REF environment variable or GitHub.ref context variable should contain the tag of the release.
See:
https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
Another way to add files to the workflow is to use the GitHub CLI:
gh release upload $GITHUB_REF path/to/file path/to/file etc
That way you don't need to pull in actions from the marketplace.
${{ github.event.release.tag_name }}
Is another way to access the tag name.
I'm working in a company that uses Github Actions and Argocd.(using argocd helm chart).
Needless to say that the Github repo is private and argocd is in an internal network that used by the company only.
The flow of what we want to do is that when we deploy the app and the deployment succeeded - Trigger another workflow that will run tests on the deployed environment.
Basically, the deployment will be the trigger for another workflow.
I have been trying to configure webhook from argocd to github but with no success.
What is the best approach to this situation, will be happy to provide more context if needed.
Edit:
The test workflow i'm trying to use workflow_dispatch.
name: workflow_02
on:
push:
branches: [ argo-github-trigger ]
workflow_dispatch:
jobs:
log-the-inputs:
runs-on: ubuntu-latest
steps:
- run: |
echo "Worked"
I'm expecting to see a "Run workflow" button on github but it doesn't appear. On another repo, that I have Admin priviliges and can work on the main branch, I tried the same workflow and it worked.
The best approach would be to use a post sync hook.
Why is it necessary to run the tests in a GitHub actions workflow? Since the application is already deployed to the cluster, wouldn't it make more sense to run the tests directly on the cluster, instead of going through the trouble of communicating with Github?
I have a GitHub page being deployed on my main repo (x.github.io). This website is being update through GitHub actions from others repo which pushes files to this main repo. The action pages-build-deployment is triggered each time there's a push to the main repo. However, some pushes take place close to one another, so the pages-build-deployment gets canceled and reruns in order to deploy the latest version of the website.
How can I stop this behavior so that it doesn't get canceled and instead finishes the current deployment?
You should try defining concurrency at your workflow.
ex.:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
More info: here and here
Currently, our team has limited GitHub actions in minutes, so I would only like to run GitHub actions when the WIP flag is not present.
Currently we use this plugin WIP to check if a branch is work in progress.
Is there a way that if the commit is flagged as WIP, that the GitHub actions to not trigger so we can conserve our monthly minutes allowance?
You should be able to use the pull_request event with the ready_for_review or even review_requested tags.
This example will only run when a pull request is marked ready for review.
on:
pull_request:
types: [ready_for_review]
Draft pull requests
Pull request trigger event
I am playing with github actions and trying to do something whenever other check is completed. I see 0 runs for this action.
This action is available in master branch and I am opening PR to the master.
I've tried to capture events via webhooks and I receive events there just fine. Why is my action not working?
Code below:
name: on check run
on:
check_run:
types: [ completed, rerequested, completed, requested_action]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v1
- name: ENV
run: env
- name: check out event
run: cat "$GITHUB_EVENT_PATH"
update
I also tried to have other checks in the repository (travis ci), the action is still not executed.
update 2
It turned out I was looking for different event that I needed. I confused status even with "check run" event. Travis ci in it's default setup produced "status" event, "check" api needs to be enabled separately
I think the issue might be that the GitHub Checks API support on Travis was only added to travis-ci.com. So if your checks are running on travis-ci.org you need to migrate.
See this blog post for the announcement.
https://blog.travis-ci.com/2018-05-07-announcing-support-for-github-checks-api-on-travis-ci-com
It is available to private and open source projects using travis-ci.com
This is the announcement about migration of
https://blog.travis-ci.com/2018-09-27-deprecating-github-commit-status-api-for-github-apps-managed-repositories
As part of our gradual migration to GitHub Apps for our GitHub integration, we’re formally deprecating GitHub Commit Status API updates for repositories on travis-ci.com managed by GitHub Apps. Instead, these repositories will have status updates reported to the GitHub Check Runs API.