Bump the production-dependencies group with 1 update #1279
Workflow file for this run
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
name: Testing the action | |
on: | |
push: | |
workflow_dispatch: | |
# declare default GITHUB_TOKEN permissions as read only. | |
permissions: read-all | |
jobs: | |
test-load-from-user: # test the action for the user space | |
name: User space | |
runs-on: ubuntu-latest | |
concurrency: | |
group: single-run | |
cancel-in-progress: false | |
env: | |
user: ${{ vars.USER }} | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
# make sure we have a new build, in case the dist folder was not updated | |
- name: Compile with NPM | |
run: | | |
npm ci | |
npm run all | |
# run the test | |
- uses: ./ | |
name: Load available actions | |
with: | |
PAT: ${{ secrets.PAT }} | |
user: ${{ env.user }} | |
id: load-actions | |
# check if the result file is not empty | |
- name: Check if the result file is not empty | |
run: | | |
if [ ! -s "${{ steps.load-actions.outputs.actions-file-path }}" ]; then | |
echo "The result file is empty" | tee "$GITHUB_STEP_SUMMARY" | |
exit 1 | |
fi | |
echo "Found [$(jq '.actions | length' "${{ steps.load-actions.outputs.actions-file-path }}")] actions in the user space of [${{ env.user }}]" | tee "$GITHUB_STEP_SUMMARY" | |
- name: Check if the result file has actions in it | |
run: | | |
# check if the file has actions in it | |
if [ "$(jq '.actions | length' "${{ steps.load-actions.outputs.actions-file-path }}")" -eq 0 ]; then | |
echo ":warning: The result file does not contain any actions" | tee "$GITHUB_STEP_SUMMARY" | |
exit 1 | |
fi | |
- name: Check if the results file has duplicate actions | |
run: | | |
# check if the file has actions in it | |
# this is WIP, it seems like there where duplicates of the actions results since we picked up the normal repos in the forks search as well (was fixed) | |
echo "Actions array length = $(jq '.actions | length' "${{ steps.load-actions.outputs.actions-file-path }}")" | |
echo "Unique actions by name = $(jq '.actions | unique_by({name, repo}) | length' "${{ steps.load-actions.outputs.actions-file-path }}")" | |
if [ "$(jq '.actions | length' "${{ steps.load-actions.outputs.actions-file-path }}")" -ne "$(jq '.actions | unique_by({name, repo}) | length' "${{ steps.load-actions.outputs.actions-file-path }}")" ]; then | |
echo "The result file contains duplicate actions" | tee "$GITHUB_STEP_SUMMARY" | |
# group the actions to find the duplicates | |
jq '.actions | group_by({name, repo}) | map(select(length > 1))' "${{ steps.load-actions.outputs.actions-file-path }}" | |
exit 1 | |
fi | |
# upload the second result file as an artefact | |
- name: Upload result file as artefact | |
if: always() | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
with: | |
name: actions-user | |
path: ${{ steps.load-actions.outputs.actions-file-path }} | |
# run the test with a different filename | |
- uses: ./ | |
name: Load available actions | |
with: | |
PAT: ${{ secrets.PAT }} | |
user: ${{ vars.USER }} | |
outputFilename: actions-second-run.json | |
id: load-actions-second-run | |
# check if the second result file is not empty | |
- name: Check if the second result file is not empty | |
run: | | |
if [ ! -s '${{ steps.load-actions-second-run.outputs.actions-file-path }}' ]; then | |
echo "The result file is empty" | tee "$GITHUB_STEP_SUMMARY" | |
exit 1 | |
fi | |
# upload the second result file as an artefact | |
- name: Upload result file as artefact | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
with: | |
name: actions-user-second-run | |
path: ${{ steps.load-actions-second-run.outputs.actions-file-path }} | |
# validate that the two files have different names | |
- name: Validate that the two files have different names | |
run: | | |
if [ ${{ steps.load-actions.outputs.actions-file-path }} == ${{ steps.load-actions-second-run.outputs.actions-file-path }} ]; then | |
echo ":warning: The two files have the same name, this is not good" | tee "$GITHUB_STEP_SUMMARY" | |
exit 1 | |
else | |
echo "The two files have different names, this is good" | tee "$GITHUB_STEP_SUMMARY" | |
fi | |
test-load-from-organization-with-forks: # test the action for the organization space | |
needs: test-load-from-user | |
runs-on: ubuntu-latest | |
concurrency: | |
group: single-run | |
cancel-in-progress: false | |
name: Org with forks | |
env: | |
organization: ${{ vars.ORGANIZATION }} | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
# make sure we have a new build, in case the dist folder was not updated | |
- name: Compile with NPM | |
run: | | |
npm ci | |
npm run all | |
# run the test | |
- uses: ./ | |
name: Load available actions | |
with: | |
PAT: ${{ secrets.PAT }} | |
organization: ${{ env.organization }} | |
id: load-actions | |
# check if the result file is not empty | |
- name: Check if the result file is not empty | |
run: | | |
if [ ! -s "${{ steps.load-actions.outputs.actions-file-path }}" ]; then | |
echo "The result file is empty" | tee "$GITHUB_STEP_SUMMARY" | |
exit 1 | |
fi | |
echo "Found [$(jq '.actions | length' "${{ steps.load-actions.outputs.actions-file-path }}")] actions in the organization [${{ env.organization }}]" | tee "$GITHUB_STEP_SUMMARY" | |
- name: Check if the result file has actions in it | |
run: | | |
# check if the file has actions in it | |
if [ "$(jq '.actions | length' "${{ steps.load-actions.outputs.actions-file-path }}")" -eq 0 ]; then | |
echo ":warning: The result file does not contain any actions" | tee "$GITHUB_STEP_SUMMARY" | |
exit 1 | |
fi | |
- name: Upload result file as artefact | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
if: always() | |
with: | |
name: actions-organization-with-forks | |
path: ${{ steps.load-actions.outputs.actions-file-path }} | |
test-load-from-organization: # test the action for the organization space | |
name: Org without forks | |
needs: test-load-from-organization-with-forks | |
runs-on: ubuntu-latest | |
concurrency: | |
group: single-run | |
cancel-in-progress: false | |
env: | |
organization: actions # load from github.com/actions | |
if: always() | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
# make sure we have a new build, in case the dist folder was not updated | |
- name: Compile with NPM | |
run: | | |
npm ci | |
npm run all | |
# run the test | |
- uses: ./ | |
name: Load available actions | |
with: | |
PAT: ${{ secrets.PAT }} | |
organization: ${{ env.organization }} | |
id: load-actions | |
# check if the result file is not empty | |
- name: Check if the result file is not empty | |
run: | | |
if [ ! -s '${{ steps.load-actions.outputs.actions-file-path }}' ]; then | |
echo "The result file is empty" | |
exit 1 | |
fi | |
echo "Found [$(jq '.actions | length' "${{ steps.load-actions.outputs.actions-file-path }}")] actions in the organization [${{ env.organization }}]" | tee "$GITHUB_STEP_SUMMARY" | |
- name: Check if the result file has actions in it | |
run: | | |
# check if the file has actions in it | |
if [ "$(jq ".actions | length" "${{ steps.load-actions.outputs.actions-file-path }}")" -eq 0 ]; then | |
echo ":warning: The result file does not contain any actions" | tee "$GITHUB_STEP_SUMMARY" | |
exit 1 | |
fi | |
- name: Upload result file as artefact | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
with: | |
name: actions-organization | |
path: ${{ steps.load-actions.outputs.actions-file-path }} | |
Consolidate: | |
runs-on: ubuntu-latest | |
needs: | |
- test-load-from-user | |
- test-load-from-organization | |
- test-load-from-organization-with-forks | |
steps: | |
- uses: actions/download-artifact@87c55149d96e628cc2ef7e6fc2aab372015aec85 # v4.1.3 | |
- run: | | |
ls -la | |
# make sure the three expected directories exists | |
if [ ! -d "actions-user" ]; then | |
echo "actions-user directory does not exist" | |
fi | |
if [ ! -d "actions-organization" ]; then | |
echo "actions-organization directory does not exist" | |
fi | |
if [ ! -d "actions-organization-with-forks" ]; then | |
echo "actions-organization-with-forks directory does not exist" | |
fi | |
# check if the file contains archived repos: | |
archiveActionsUserSpace=$(jq -s '.[].isArchived==true' "./actions-user/actions.json") | |
archiveActionsActionsSpace=$(jq -s '.[].isArchived==true' "./actions-organization/actions.json") | |
archiveActionsOrgWithForksSpace=$(jq -s '.[].isArchived==true' "./actions-organization-with-forks/actions.json") | |
echo "Found [$archiveActionsUserSpace] archived actions in the user space" | tee "$GITHUB_STEP_SUMMARY" | |
echo "Found [$archiveActionsActionsSpace] archived actions in the 'actions' organization space" | tee "$GITHUB_STEP_SUMMARY" | |
echo "Found [$archiveActionsOrgWithForksSpace] archived actions in the org with forks space" | tee "$GITHUB_STEP_SUMMARY" | |
# load the actions from the user | |
userActionsLength=$(jq -s '.[]' "./actions-user/actions.json") | |
organizationActionsLength=$(jq -s '.[]' "./actions-organization/actions.json") | |
organizationWithForksActionsLength=$(jq -s '.[]' "./actions-organization-with-forks/actions.json") | |
# test if the lenghts are all different | |
if ((userActionsLength == organizationActionsLength)); then | |
echo "The user actions and the organization actions are the same length, which should not be the case" | |
exit 1 | |
fi | |
if ((organizationWithForksActionsLength == organizationActionsLength)); then | |
echo "The organization with forks actions and the organization actions are the same length, which should not be the case" | |
exit 1 | |
fi | |
if ((userActionsLength == organizationWithForksActionsLength)); then | |
echo "The user actions and the organization with forks actions are the same length, which should not be the case" | |
exit 1 | |
fi |