install.fairie/.config/taskfiles/ci/Taskfile-github.yml
Brian Zalewski f42899b107 Latest
2022-12-24 15:04:59 -05:00

45 lines
1.5 KiB
YAML

---
version: '3'
tasks:
actions:test:
deps:
- :install:software:act
- :install:software:docker
desc: Locally test the on-push GitHub Action event (only works for Linux containers)
hide:
sh: '! test -d .github/workflows'
summary: |
# Test GitHub Actions
This task ensures Docker and Act are installed. It then uses Act to locally
test Linux-based on-push GitHub Action events.
See [Act's README.md](https://github.com/nektos/act) for more information.
log:
error: Error encountered while testing GitHub Actions locally with `act`
start: Testing GitHub Actions locally with `act`
success: Completed local GitHub Actions test
cmds:
- act
synchronize:
deps:
- :install:software:git
summary: |
Forces a push to the GitHub master branch so that GitHub stays mirrored with
the GitLab master branch.
env:
GITHUB_HTTP_REPO:
sh: jq -r '.blueprint.repository.github' package.json
cmds:
- cmd: |
if [ "$GITHUB_HTTP_REPO" != 'null' ]; then
GITHUB_REPO_WITH_TOKEN="$(echo "$GITHUB_HTTP_REPO" | sed "s/github.com/${GITHUB_TOKEN}@github.com/")"
git remote add github "${GITHUB_REPO_WITH_TOKEN}.git"
git fetch --unshallow origin
git push github master --force
else
.config/log warn 'The .blueprint.repository.github field is missing! Cannot synchronize to GitHub.'
fi
ignore_error: true