"Error: An action could not be found at the URI" when attempting to reference a stand alone repo

I created a repo in our org in order to create a ‘action container’ that could be generic enough to be used by any other repo’s in actions workflows.

When I attempt to use the action container I get an error message:

Error: An action could not be found at the URI Error: An action could not be found at the URI 'https://api.github.com/repos/actions/checkout/tarball/10c0fabc8ec....

Here is a minimalist overview of first repo that I made. The purpose of this repo is to create an action container for SnowSQL for use by other repos within our org.

Repo <ourorg>/my-ssql-container-action

  • Dockerfile
  • action.yml
  • buildtime.sh

Dockerfile:

### Draws from https://github.com/kurron/docker-snowsql/blob/b1b16ff88b36f9df58f692a69642e84f353c2d46/Dockerfile ###

FROM ubuntu:18.04

RUN apt-get update && apt-get --assume-yes install -y curl

# Create non-root user
RUN groupadd --system snowflake --gid 444 && \
useradd --uid 444 --system --gid snowflake --home-dir /home/snowflake --create-home --shell /sbin/nologin --comment "Docker image user" snowflake && \
chown -R snowflake:snowflake /home/snowflake

# default to being in the user's home directory
WORKDIR /home/snowflake

ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV VERSION 1.2.9
ENV SNOWSQL_DEST /usr/local/bin
ENV SNOWSQL_LOGIN_SHELL /home/snowflake/.bashrc

# grab the installation script
RUN curl -O https://sfc-repo.snowflakecomputing.com/snowsql/bootstrap/1.2/linux_x86_64/snowsql-1.2.9-linux_x86_64.bash

# Install the tool
## Add unzip first, avoid error
RUN apt-get install -y unzip vim
RUN bash snowsql-1.2.9-linux_x86_64.bash

# Run commands via bash script that could not be done directly due to gh actions permissions restrictions
COPY ./buildtime.sh /home/snowflake/buildtime.sh
ENTRYPOINT ["/home/snowflake/buildtime.sh"]

action.yml:

# action.yml

name: 'get data'
description: 'Get data using snowsql and save in a volume for rscripts to use'
inputs:
  PRIVATE_KEY_PATH:
    decsription: 'Path to the pipelines private ssql key'
    required: true
  SNOWSQL_PRIVATE_KEY_PASSPHRASE:
    description: 'Password to your ssql private key'
    required: true
  AWS_REGION:
    description: 'AWS_REGION'
    required: true
  AWS_ACCESS_KEY_ID:
    description: 'AWS key for S3'
    required: true
  AWS_SECRET_ACCESS_KEY:
    description: 'AWS_SECRET_ACCESS_KEY'
    required: true
  QUERY_FILE:
    description: 'path/to/the/sql/file/to/execute.sql'
    resuired: true
outputs:
  data-json:
    description: 'json output of the returned table'
runs:
  using: 'docker'
  image: 'Dockerfile'
  args:
    - ${{ inputs.PRIVATE_KEY_PATH }}
    - ${{ inputs.SNOWSQL_PRIVATE_KEY_PASSPHRASE }}
    - ${{ inputs.AWS_REGION }}
    - ${{ inputs.AWS_ACCESS_KEY_ID }}
    - ${{ inputs.AWS_SECRET_ACCESS_KEY }}
    - ${{ inputs.QUERY_FILE }}

buildtime.sh:

#!/bin/bash

# Switch to the non-root user
su - snowflake

# Run the SnowSQL client once, allowing it to auto-upgrade to the latest version.
# See https://docs.snowflake.com/en/user-guide/snowsql-install-config.html#label-understanding-auto-upgrades
snowsql -v

echo 'done!'

I tested these files on local using Docker, when I build I see the ‘done!’ message from buildtime.sh.

After confirming this works I pushed all 3 files to a repo within our org.

Then, in another repo I attempted to use this action within a workflow.

/some-repo-that-uses-snowsql:

  • config # a config file for snowsql
  • training-data.sql # a sql file that the repo will run using the container action I created in my-ssql-container-action
  • .github/workflows/main.yml

Here’s the workflow file main.yml:

on: [push]

jobs:
  ssql_job:
    runs-on: ubuntu-latest
    name: Build ssql image
    steps:
      - name: Checkout # To use this repository's private action, you must check out the repository
        uses: actions/checkout@10c0fabc7ec358e5a3c4b0ab7fdce37c185ff34b
        with:
          repository: ourorg/my-ssql-container-action
          ref: main
      - name: Build
        uses: ./ # Uses an action in the root directory 
        with:
          config: ./config # the config file for snowsql
          query: ./training-data.sql
        env:
          SSQL_PRIVATE_KEY: ${{ secrets.SSQL_PRIVATE_KEY }}
          SNOWSQL_PRIVATE_KEY_PASSPHRASE: ${{ secrets.SNOWSQL_PRIVATE_KEY_PASSPHRASE }}
          AWS_REGION: 'us-east-1'
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          QUERY_FILE: 'training-data.sql'

Now, when I push to <ourorg>/some-repo-that-uses-snowsql I see the following under the actions tab:

Am unsure what other information to provide.

How can I set up my workflow in order to reference my container action <ourorg>/my-ssql-container-action and use it within a workflow within <ourorg>/some-repo-that-uses-snowsql?

The error message is just saying that it can’t retrieve a snapshot of actions/checkout for the specified sha.

I don’t know where this magic sha came from:

GitHub doesn’t believe in it. (Nor does Google!)

If you want to pin to the current value (from main), you could use:

-actions/checkout@10c0fabc7ec358e5a3c4b0ab7fdce37c185ff34b
+actions/checkout@afe4af09a72596f47d806ee5f8b2674ec07fdc73

The latest release appears to be 5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f

Personally, I’ve switched to using @v2 – I don’t need the Dependabot PRs for each checkout bump.

Note that GitHub changed the behavior for actions a while ago to not allow short shas, but what you haven’t isn’t a short sha. I suppose it could have been a custom commit in a fork of actions/checkout that was deleted, but in general such things don’t get GCd…

1 Like

Hi jsoref. I think I’ve misunderstood something with actions. I’m having a d’oh Homer Simpson moment!

I thought that I checkout from my own repo where I created the action. It looks like I need to checkout actions from a universal, widely used by all repo GitHub - actions/checkout: Action for checking out a repo.

I don’t know where this magic sha came from:

Right! That’s the commit from my own repo at <ourorg>/my-ssql-container-action whereas thanks to your comment I now realize I need to use this universally used actions repo that you linked to.

I’m going to try that out today, thanks for the indirect tip

1 Like