Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AEA-3622 Fix GitHub actionlint errors and enable #82

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ ENV PATH="$PATH:/home/vscode/.asdf/bin/"
RUN asdf plugin add python; \
asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git; \
asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git; \
asdf plugin-add direnv; \
asdf plugin-add golang https://github.com/kennyp/asdf-golang.git; \
asdf plugin add direnv; \
asdf plugin add golang https://github.com/kennyp/asdf-golang.git; \
asdf plugin add golangci-lint https://github.com/hypnoglow/asdf-golangci-lint.git; \
asdf plugin add actionlint;


WORKDIR /workspaces/electronic-prescription-service-get-secrets
ADD .tool-versions /workspaces/electronic-prescription-service-get-secrets/.tool-versions
ADD .tool-versions /home/vscode/.tool-versions
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/dependabot_auto_approve_and_merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ jobs:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve patch and minor updates
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' || steps.dependabot-metadata.outputs.update-type == 'version-update:semver-minor'}}
run: gh pr review $PR_URL --approve -b "I'm **approving** this pull request because **it includes a patch or minor update**"
run: gh pr review "$PR_URL" --approve -b "I'm **approving** this pull request because **it includes a patch or minor update**"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{ steps.get_app_token.outputs.token }}
- name: Approve major updates of development dependencies
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' && steps.dependabot-metadata.outputs.dependency-type == 'direct:development'}}
run: gh pr review $PR_URL --approve -b "I'm **approving** this pull request because **it includes a major update of a dependency used only in development**"
run: gh pr review "$PR_URL" --approve -b "I'm **approving** this pull request because **it includes a major update of a dependency used only in development**"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{ steps.get_app_token.outputs.token }}
- name: Comment on major updates of non-development dependencies
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' && steps.dependabot-metadata.outputs.dependency-type == 'direct:production'}}
run: |
gh pr comment $PR_URL --body "I'm **not approving** this PR because **it includes a major update of a dependency used in production**"
gh pr edit $PR_URL --add-label "requires-manual-qa"
gh pr comment "$PR_URL" --body "I'm **not approving** this PR because **it includes a major update of a dependency used in production**"
gh pr edit "$PR_URL" --add-label "requires-manual-qa"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{ steps.get_app_token.outputs.token }}
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/pr-link.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ on:
jobs:
link-ticket:
runs-on: ubuntu-latest
env:
REF: ${{ github.event.pull_request.head.ref }}
steps:
- name: Check ticket name conforms to requirements
run: echo ${{ github.event.pull_request.head.ref }} | grep -i -E -q "(aea-[0-9]+)|(apm-[0-9]+)|(apmspii-[0-9]+)|(adz-[0-9]+)|(amb-[0-9]+)|(dependabot\/)"
run: echo "$REF" | grep -i -E -q "(aea-[0-9]+)|(apm-[0-9]+)|(apmspii-[0-9]+)|(adz-[0-9]+)|(amb-[0-9]+)|(dependabot\/)"
continue-on-error: true

- name: Grab ticket name
if: contains(github.event.pull_request.head.ref, 'aea-') || contains(github.event.pull_request.head.ref, 'AEA-') || contains(github.event.pull_request.head.ref, 'apm-') || contains(github.event.pull_request.head.ref, 'APM-') || contains(github.event.pull_request.head.ref, 'apmspii-') || contains(github.event.pull_request.head.ref, 'APMSPII-') || contains(github.event.pull_request.head.ref, 'adz-') || contains(github.event.pull_request.head.ref, 'ADZ-') || contains(github.event.pull_request.head.ref, 'amb-') || contains(github.event.pull_request.head.ref, 'AMB-')
run: echo ::set-env name=TICKET_NAME::$(echo ${{ github.event.pull_request.head.ref }} | grep -i -o '\(aea-[0-9]\+\)\|\(apm-[0-9]\+\)\|\(apmspii-[0-9]\+\)\|\(adz-[0-9]\+\)|\(amb-[0-9]\+\)' | tr '[:lower:]' '[:upper:]')
run: |
# shellcheck disable=SC2046
echo name=TICKET_NAME::$(echo "$REF" | grep -i -o '\(aea-[0-9]\+\)\|\(apm-[0-9]\+\)\|\(apmspii-[0-9]\+\)\|\(adz-[0-9]\+\)|\(amb-[0-9]\+\)' | tr '[:lower:]' '[:upper:]') >> "$GITHUB_ENV"
continue-on-error: true
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ jobs:
make install-python

- name: Set SPEC_VERSION env var for merges to main
run: echo "SPEC_VERSION=$(poetry run python scripts/calculate_version.py)" >> $GITHUB_ENV
run: echo "SPEC_VERSION=$(poetry run python scripts/calculate_version.py)" >> "$GITHUB_ENV"
if: github.ref == 'refs/heads/main'

- name: Set SPEC_VERSION env var for tags
run: echo "SPEC_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
run: echo "SPEC_VERSION=${{ github.ref_name }}" >> "$GITHUB_ENV"
if: github.ref != 'refs/heads/main'

- name: Download build artifact
Expand Down Expand Up @@ -88,4 +88,4 @@ jobs:

- name: output SPEC_VERSION
id: output_spec_version
run: echo SPEC_VERSION=${{ env.SPEC_VERSION }} >> $GITHUB_OUTPUT
run: echo SPEC_VERSION=${{ env.SPEC_VERSION }} >> "$GITHUB_OUTPUT"
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,14 @@ repos:
files: ^src
pass_filenames: false

- id: lint-githubactions
name: Lint github actions
entry: make
args: ["lint-githubactions"]
language: system
files: ^.github
types_or: [yaml]
pass_filenames: false

fail_fast: true
default_stages: [commit]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ lint-go:
lint-githubactions:
actionlint

lint: lint-go
lint: lint-go lint-githubactions

clean:
rm -rf ./lib
Expand Down