Skip to content

Instantly share code, notes, and snippets.

@jmarshall
Last active October 24, 2023 23:30
Show Gist options
  • Save jmarshall/905c70610b09e6b27917d14f2777a3a0 to your computer and use it in GitHub Desktop.
Save jmarshall/905c70610b09e6b27917d14f2777a3a0 to your computer and use it in GitHub Desktop.
Determine node runtime version used by common GitHub Actions
#!/usr/bin/perl
#
# Usage: grep uses: {DIR,DIR}/.github/workflows/*.y*l | actionversions
# or: git grep uses: | actionversions
# or: cat .github/workflows/*.y*l | actionversions
my %used;
while (<>) {
next unless /uses\s*:\s*['"]?([^'"\s]+)/;
$used{$1}++;
}
my %note;
while (<DATA>) {
chomp;
next if /^#/ or $_ !~ /\S/;
my ($action, $note) = split /\t/, $_;
$note{$action} = $note;
}
my %cat;
foreach my $action (sort keys %used) {
my $note = exists $note{$action}? $note{$action} : "UNKNOWN";
$cat{$note} .= sprintf "%4d\t%s\n", $used{$action}, $action;
}
foreach my $cat (sort keys %cat) {
print "$cat\n$cat{$cat}\n";
}
__DATA__
actions/cache@v3 node16
actions/checkout@v2 bad (node12)
actions/checkout@v3 node16
actions/checkout@v4 node20
actions/github-script@v3 bad (node12)
actions/github-script@v4 bad (node12)
actions/github-script@v5 bad (node12)
actions/github-script@v6 node16
actions/setup-java@v2 bad (node12)
actions/setup-java@v3 node16
# (node20 in PR #533)
actions/setup-python@v2 bad (node12)
actions/setup-python@v3 node16
actions/setup-python@v4 node16
azure/login@v1 node16
# since v1.4.5 (June 2022; is in v1 tag)
codecov/codecov-action@v2 bad (node12)
codecov/codecov-action@v3 node16
conda-incubator/setup-miniconda@v2 node16
# since v2.2.0 (Nov 2022; is in v2 tag)
gaurav-nelson/github-action-markdown-link-check@v1 node16 (probably)
google-github-actions/auth@v1 node16
google-github-actions/setup-gcloud@v1 node16
pulumi/actions@v4 node16
# (node20 based on master, needs a release)
pypa/gh-action-pypi-publish@release/v1 node16 (probably)
thollander/actions-comment-pull-request@v1 node16 (probably)
thollander/actions-comment-pull-request@v2 node16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment