Include comparison URLs in PR body
This commit is contained in:
parent
fd510d25c0
commit
c757b01bd9
12
action.yml
12
action.yml
|
@ -38,6 +38,8 @@ inputs:
|
||||||
{{ env.GIT_COMMIT_MESSAGE }}
|
{{ env.GIT_COMMIT_MESSAGE }}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
{{ env.GIT_COMMIT_MESSAGE_2 }}
|
||||||
|
|
||||||
### Running GitHub Actions on this PR
|
### Running GitHub Actions on this PR
|
||||||
|
|
||||||
GitHub Actions will not run workflows on pull requests which are opened by a GitHub Action.
|
GitHub Actions will not run workflows on pull requests which are opened by a GitHub Action.
|
||||||
|
@ -154,6 +156,9 @@ runs:
|
||||||
TARGETS: ${{ inputs.inputs }}
|
TARGETS: ${{ inputs.inputs }}
|
||||||
COMMIT_MSG: ${{ inputs.commit-msg }}
|
COMMIT_MSG: ${{ inputs.commit-msg }}
|
||||||
PATH_TO_FLAKE_DIR: ${{ inputs.path-to-flake-dir }}
|
PATH_TO_FLAKE_DIR: ${{ inputs.path-to-flake-dir }}
|
||||||
|
- name: Compare flake.lock files
|
||||||
|
run: $GITHUB_ACTION_PATH/compare-flake-lock.sh | tee urls.txt
|
||||||
|
shell: bash
|
||||||
- name: Save PR Body as file
|
- name: Save PR Body as file
|
||||||
uses: DamianReeves/write-file-action@v1.2
|
uses: DamianReeves/write-file-action@v1.2
|
||||||
with:
|
with:
|
||||||
|
@ -169,6 +174,11 @@ runs:
|
||||||
echo "$COMMIT_MESSAGE" >> $GITHUB_ENV
|
echo "$COMMIT_MESSAGE" >> $GITHUB_ENV
|
||||||
echo "$DELIMITER" >> $GITHUB_ENV
|
echo "$DELIMITER" >> $GITHUB_ENV
|
||||||
echo "GIT_COMMIT_MESSAGE is: ${COMMIT_MESSAGE}"
|
echo "GIT_COMMIT_MESSAGE is: ${COMMIT_MESSAGE}"
|
||||||
|
COMMIT_MESSAGE_2="$(cat urls.txt)"
|
||||||
|
echo "GIT_COMMIT_MESSAGE_2<<$DELIMITER" >> $GITHUB_ENV
|
||||||
|
echo "$COMMIT_MESSAGE_2" >> $GITHUB_ENV
|
||||||
|
echo "$DELIMITER" >> $GITHUB_ENV
|
||||||
|
echo "GIT_COMMIT_MESSAGE_2 is: ${COMMIT_MESSAGE_2}"
|
||||||
- name: Interpolate PR Body
|
- name: Interpolate PR Body
|
||||||
uses: pedrolamas/handlebars-action@v2.2.0
|
uses: pedrolamas/handlebars-action@v2.2.0
|
||||||
with:
|
with:
|
||||||
|
@ -184,7 +194,7 @@ runs:
|
||||||
# action commits all new and modified files).
|
# action commits all new and modified files).
|
||||||
- name: Remove PR body template files
|
- name: Remove PR body template files
|
||||||
shell: bash
|
shell: bash
|
||||||
run: rm -f pr_body.txt pr_body.template
|
run: rm -f pr_body.txt pr_body.template urls.txt
|
||||||
- name: Create PR
|
- name: Create PR
|
||||||
id: create-pr
|
id: create-pr
|
||||||
uses: peter-evans/create-pull-request@v4
|
uses: peter-evans/create-pull-request@v4
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
git checkout HEAD~1 &>/dev/null
|
||||||
|
nodes1="$(nix flake metadata '.#' --json | jq '.locks.nodes')"
|
||||||
|
git checkout - &>/dev/null
|
||||||
|
nodes2="$(nix flake metadata '.#' --json | jq '.locks.nodes')"
|
||||||
|
keys1="$(echo "${nodes1}" | jq 'keys | .[]')"
|
||||||
|
keys2="$(echo "${nodes2}" | jq 'keys | .[]')"
|
||||||
|
|
||||||
|
if [[ "${keys1}" != "${keys2}" ]]; then
|
||||||
|
echo 'Flake inputs changed!'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for key in ${keys1}; do
|
||||||
|
owner="$(echo "${nodes1}" | jq -r ".${key}.locked.owner")"
|
||||||
|
repo="$(echo "${nodes1}" | jq -r ".${key}.locked.repo")"
|
||||||
|
type="$(echo "${nodes1}" | jq -r ".${key}.locked.type")"
|
||||||
|
rev1="$(echo "${nodes1}" | jq -r ".${key}.locked.rev")"
|
||||||
|
rev2="$(echo "${nodes2}" | jq -r ".${key}.locked.rev")"
|
||||||
|
if [[ "${rev1}" != "${rev2}" ]]; then
|
||||||
|
if [[ "${type}" == 'github' ]]; then
|
||||||
|
echo "- https://github.com/${owner}/${repo}/compare/${rev1}...${rev2}"
|
||||||
|
fi
|
||||||
|
# TODO: support gitlab and possibly other services
|
||||||
|
fi
|
||||||
|
done
|
Loading…
Reference in New Issue