forked from nix-community/nixvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fcb782c
commit f186bd0
Showing
1 changed file
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
name: new-plugin | ||
on: | ||
push: | ||
branch: | ||
- "main" | ||
paths: | ||
- "plugins/**" | ||
|
||
jobs: | ||
job1: | ||
name: TODO name the job | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 40 | ||
if: github.repository == 'nix-community/nixvim' | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ssh-key: ${{ secrets.CI_UPDATE_SSH_KEY }} | ||
|
||
- name: Install Nix | ||
uses: cachix/install-nix-action@v26 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
github_access_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Get plugins info | ||
run: | | ||
OLD="$( | ||
nix eval 'github:${{ github.repository }}/${{ github.event.before }}#nixvimConfiguration.options.plugins' \ | ||
--apply 'builtins.attrNames' \ | ||
--json | ||
)" | ||
NEW="$( | ||
nix eval '.#nixvimConfiguration.options.plugins' \ | ||
--apply 'builtins.attrNames' \ | ||
--json | ||
)" | ||
# TODO: compare OLD and NEW | ||
- name: Get PR info | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
if JSON="$( | ||
gh api \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
/repos/${{ github.repository }}/commits/${{ github.sha }}/pulls | ||
)" | ||
then | ||
# TODO: use PR info | ||
else | ||
# TODO: handle error getting PR info | ||
fi | ||
- name: Send matrix message | ||
uses: lkiesow/matrix-notification@v1 | ||
with: | ||
# The Matrix home server to send the message to | ||
# Default: matrix.org | ||
server: matrix.org | ||
# TODO: token | ||
token: ... | ||
room: "!oOLohuKTgwSAvIxmdO:matrix.org" | ||
# The message to send (optional) | ||
message: Hello world | ||
# An HTML formatted version of the message to send | ||
formatted_message: Hello <b>World</b>! | ||
# Whether to install the `matrix-msg` exe | ||
# Only needed if you wish to send messages in other steps | ||
# We could use this to print a "summary" and a matrix message in the same step, for example | ||
tool: false | ||
|
||
- name: Print summary | ||
run: | | ||
# FIXME: copied from update workflow | ||
# TODO: adapt to this workflow | ||
num="${{ steps.pr.outputs.pull-request-number }}" | ||
pr_url="${{ steps.pr.outputs.pull-request-url }}" | ||
pr_branch="${{ steps.pr.outputs.pull-request-branch }}" | ||
head="${{ steps.pr.outputs.pull-request-head-sha }}" | ||
operation="${{ steps.pr.outputs.pull-request-operation }}" | ||
# stdout | ||
echo "${head:0:6} pushed to ${pr_branch}" | ||
echo "${pr} was ${operation}." | ||
# markdown summary | ||
echo "## ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY | ||
echo >> $GITHUB_STEP_SUMMARY | ||
echo "\`${head:0:6}\` pushed to \`${pr_branch}\`" >> $GITHUB_STEP_SUMMARY | ||
echo >> $GITHUB_STEP_SUMMARY | ||
echo "[#${num}](${pr_url}) was ${operation}." >> $GITHUB_STEP_SUMMARY | ||
echo >> $GITHUB_STEP_SUMMARY |